Recently a client had an issue where Woocommerce product variations on the front end stopped working when there were more than 30 variations for the product. Fortunately there’s an easy fix for this bug.

WooCommerce by default uses a streamlined ajax threshold to populate the dropdowns on the product, but this streamlining can be restrictive since it’s set to a limit of 30 products. To fix this, we’ll be hooking to the woocommerce_ajax_variation_threshold filter.

Add the following code to your child theme’s functions.php and the limit will be raised to 100. Change the return value if you need more.

add_filter( 'woocommerce_ajax_variation_threshold', 'wc_ninja_ajax_threshold' );
function wc_ninja_ajax_threshold() {
    return 100;