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 );
Thanks, Warren. Worked perfectly.
Thanks Buddy.
Wich functions.php? there are a lot, could you be more specific, thank you :)
The functions.php you need is the one from your theme, or child theme. Sorry for any confusion.
didn’t work for me :/
Try increasing the number (100) Sara. On products with many variations and combinations of variations, you may find it needs to be higher. Good luck.
There’s another possibility.
If your variants don’t yet have a price set for them, try adding one:
===
To resolve this go to Product -> Variations -> click on the dropdown box which defaults to “Add Variation” -> Set Regular Prices -> click Go. [and thus set a price for all variants]
===
That’s what worked for me.
Thanks for the comment Chris.
@Chris W Thanks so much for that suggestion. That was the fix for my issue.
hi Sarah,did you find solution to your problem?will be much appriciating
Doesn’t work for me ;-(
Have you tried increasing the number in your function, Petra? On larger shops with many variations per product, increasing the number will help. That said, WooCommerce can be clunky at times with so many variations and be slow to update. Be warned! :) Good luck.
Hello Warren,i have tried all the suggestions, but did not worked for me..Any other suggestions ?
According to the WooCommerce developers, this issue has been fixed and the only way this can happen is if you haven’t added the necessary information in products. Whether this is accurate is anyone’s guess however. Do you have an example I could look at?
Thank you very much. Fixed it!!!!!!
every few days or so a few product start showing up as Out of Stock on the store page. But they are not out of stock. Produce pages say out of stock but show number in stock. Only way been able to fix it is to change the stock and threshold numbers to different numbers and then change them back. weird. but keeps happening almost weekly. Updated to Woo 3.65. Updated Woo Database. Still a problem. Added the function.php info above. Still have the problem. only about 170 products with each having maybe 3 variations and they all have regular prices set. Anyone have any ideas?
My product is a simple product and I’m having this problem. Any thoughts?