fbpx
Want To Add Extra Images Per Product Variation? Download This Free Plugin

Large Number of Variations Not Working

Kyle Rolfe

I’m aware of the default ajax threshold limit being 30 and all of the codes showing how to increase the limits. I am currently using the following in my functions:

add_filter( 'woo_variation_swatches_global_ajax_variation_threshold_max', 'woo_variation_swatches_global_ajax_variation_threshold_max_edit', 10, 2 );
function woo_variation_swatches_global_ajax_variation_threshold_max_edit( $size, $product ){
return 700;
}
add_filter( 'woocommerce_ajax_variation_threshold', function($qty, $product){
return 200;
}, 10, 2 );

The product I’m testing on has 114 variations. I’ve adjusted the ‘200’ to ‘100’ and to ‘114’ to test and it still doesn’t work. If I have the number below 114 then it displays all the options, but it doesn’t disable the unavailable combinations. If I have the number above 114 then the entire forms goes away and I’m left with the “This product is currently out of stock and unavailable.” message.

The disabled options are working fine on products with less than 30 variations, it’s just those above the default that have issues.

Kyle Rolfe

Ahh, thank you, don’t know why I didn’t think of that. Seems to be working as expected now – at least from my perspective. I’ll see what the client finds, he has a knack for finding issues, haha.

 

Appreciate the help 🙂