How To Fix WooCommerce Not Hiding Disabled / Unavailable Variations?

WooCommerce by default will hide unavailable product variations regardless if you use Variation Swatches plugin or without. However, this is limited to only 30 product variations only (as of year2020). If you have more than 30 variations, WooCommerce will no longer hides disabled variations — here’s a guide on how to increase this limit.

Increase WooCommerce Unavailable/Disabled/Out of Stock Variation Limit

You will need the add the below code to your active WordPress Theme functions.php file.

function custom_woocommerce_ajax_variation_threshold( $qty, $product ) {
     return 1000; // Set 1000 to another number to load faster
}

add_filter( 'woocommerce_ajax_variation_threshold', 'custom_woocommerce_ajax_variation_threshold', 10, 2 );
Important Notice: Your site may load slower by using 1000 (as per the above example). Thus, you should consider a lower number if there’s any performance issue.
9+

Users who have LIKED this post:

  • Sofia Moss