• Resolved ckov1

    (@ckov1)


    Hi,

    little bit complicated question

    if i use filter :

    function custom_wc_ajax_variation_threshold( $qty, $product ) { return 10; } add_filter( ‘woocommerce_ajax_variation_threshold’, ‘custom_wc_ajax_variation_threshold’, 10, 2 );

    how much is max variations can i make

    for example can i make 2000?

    if someone test please tell me

    thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ckov1

    (@ckov1)

    Now testing , this code is not work

    so is there any additional code for increase max number of variations, how how long can be that number of variations ?

    Hi @ckov1

    so is there any additional code for increase max number of variations, how how long can be that number of variations ?

    From what I understand, you’re trying to increase the maximum number of product variations using a filter in WooCommerce.

    The code you have provided sets the variation threshold to 10. The ‘woocommerce_ajax_variation_threshold‘ filter controls the maximum number of variations that WooCommerce will handle before switching to AJAX to load variations on the front end. This is done to prevent slow loading times when there are a large number of variations.

    As for your question regarding whether you can set the variation threshold to 2000, technically, you can set the number as high as you want. However, you must take into consideration the server’s resources. The higher the number, the more server resources are required to load all the variations at once, which could lead to site performance issues. ?? You can find more information on Changing the Limit on the Number of Variations for Dynamic Variable Product Dropdowns Here

    If you’re facing issues with the code, ensure that it is added correctly to your theme’s functions.php file. Here’s the correct way to add it:

    function custom_wc_ajax_variation_threshold( $qty, $product ) {
    return 2000; // Change this to the number of variations you want
    }
    
    add_filter( 'woocommerce_ajax_variation_threshold', 'custom_wc_ajax_variation_threshold', 10, 2 );

    Add this code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code Snippets plugin. Remember, it’s not advisable to add custom code directly to your parent theme’s functions.php file, as updates to the theme will erase it.

    A quick reminder: Before you make any changes, we strongly recommend that you create a backup of your full site and database. This is a crucial step to ensure that in case anything goes wrong, you can easily restore your site to its previous, functioning state.

    ?? Just a heads up – while we’re always here to assist you, our scope of support doesn’t extend to custom development or design patterns, which includes troubleshooting or giving specific advice on using custom action hooks or filters.

    For custom solutions, our recommendation is to connect with Codeable.io, our trusted WooCommerce development partner. They’re experts in crafting custom solutions for WooCommerce and might be able to help you develop a custom solution for your problem. Check them out here: ?? https://woocommerce.com/codeable

    I hope this helps! Please let me know how it goes or if you have any other questions.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Max limits of number of variations’ is closed to new replies.