Skip to content

Instantly share code, notes, and snippets.

@w33zy
Created March 28, 2017 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save w33zy/0077e8d9c256ad28c6ab9bab498228f0 to your computer and use it in GitHub Desktop.
Save w33zy/0077e8d9c256ad28c6ab9bab498228f0 to your computer and use it in GitHub Desktop.
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 your functions.php file 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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment