• Hi woocommerce team,

    As discussed in this report, if the number of variables exceeds 30, the variables are not updated via Ajax. This causes problems for customers when selecting products and they have reported this to us many times.

    Is there currently a temporary solution to get around this problem?

    Thank you in advance

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Jonayed (woo-hc)

    (@jonayedhosen)

    Hi @hoseinkh ,

    I see what you’re running into—when a product has more than 30 variations, AJAX stops updating the variations dynamically, which can definitely cause issues for customers trying to select different options. It’s a default performance setting in WooCommerce.

    However, there’s a way to adjust this! You can increase the AJAX variation threshold by adding a custom filter to your theme’s functions.php file or, for a safer approach, using the Code Snippets plugin. Here’s a quick snippet to try:

    function custom_wc_ajax_variation_threshold( $qty, $product ) {
    return 100;
    }

    add_filter( 'woocommerce_ajax_variation_threshold', 'custom_wc_ajax_variation_threshold', 10, 2 );

    This raises the limit to 100 variations, so WooCommerce will keep using AJAX instead of falling back to static dropdowns. If needed, you can tweak that number based on your store’s needs.

    You can find more details here: https://woocommerce.com/document/change-limit-on-number-of-variations-for-dynamic-variable-product-dropdowns/

    I hope this helps!

    Thread Starter Hossein Khadem Abolfazl

    (@hoseinkh)

    Hi @jonayedhosen,

    Thanks for the code. It works great. But in general, are there any plans to fix this limitation in WooCommerce core?

    I understand that this limitation is to prevent performance degradation. But if a store has a small number of variables, naturally there will be no performance problem. If there are many variables, it is natural that even a small impact on performance will occur. So wouldn’t it make more sense if there were no limitation in this case?

    Thank you

    Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi there!

    I’m glad to hear that the code worked for you!

    Regarding your question, I understand your concern. The limitation is indeed in place to ensure optimal performance across a wide range of stores, particularly those with many variables or large product catalogs. While it’s true that smaller stores may not experience noticeable performance issues, the limitation is designed to prevent slower load times and reduce strain on servers for stores with larger inventories.

    I would suggest you submit a feature request here https://woocommerce.com/feature-requests/woocommerce/ if you’d like the team to consider removing or adjusting this limitation, especially for smaller stores where performance wouldn’t be impacted as much.

    If you have any other questions or need further assistance, feel free to ask!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.