UPDATE: On later versions of WooCommerce in 2020 you may also try the following fix for the 30 limit threshold. https://www.warrenchandler.com/2020/06/27/woocommerce-variations-break-after-30-or-more-bug-fix/


Recently, a client was reporting that they were seeing an out of stock message on their product page, which wasn’t correct.  All of the settings and product variations were correct and in stock, but the message persisted.

It wasn’t on all products, but just a few select variable products where it displayed:

This product is currently out of stock and unavailable

Obviously this was frustrating, but after a little investigation, the fact that they were variations was the key to fixing the problem.

Typically WooCommerce allows 60 product variations in total when using ajax to update the variations on the product page, and in most cases the error message is due to the product exceeding this. Fortunately, there’s a relatively simple fix.

Add the following code to the functions.php of your theme or child theme and you should be seeing your products back in stock in no time at all.

// Increase WooCommerce Variation Limit
function custom_wc_ajax_variation_threshold( $qty, $product ) {
return 100;
}

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