WooCommerce Product Unavailable Out of Stock Problem

/WooCommerce Product Unavailable Out of Stock Problem

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 );
2018-11-07T01:08:26+00:00November 8th, 2016|Web Programming, WordPress Snippets|12 Comments

About the Author:

Warren Chandler is a freelance web programmer and web developer, based in Frinton on Sea, Essex. Warren specialises in web programming, web design, corporate identity, copy writing, SEO, logo and print media for home, work, and mobile platforms.


  1. Irfan Saleem February 22, 2017 at 1:45 pm - Reply

    Thanks, Warren. Worked perfectly.

  2. Arsh February 28, 2017 at 2:20 pm - Reply

    Thanks Buddy.

  3. jorge March 13, 2017 at 4:38 am - Reply

    Wich functions.php? there are a lot, could you be more specific, thank you 🙂

  4. Warren Chandler April 5, 2017 at 3:44 pm - Reply

    The functions.php you need is the one from your theme, or child theme. Sorry for any confusion.

  5. Sara May 5, 2017 at 4:04 pm - Reply

    didn’t work for me :/

    • Warren Chandler July 17, 2017 at 6:22 pm - Reply

      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.

      • Chris W April 9, 2018 at 11:28 am - Reply

        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.

        • Warren Chandler April 18, 2018 at 4:31 pm - Reply

          Thanks for the comment Chris.

        • Clint May 10, 2018 at 10:13 pm - Reply

          @Chris W Thanks so much for that suggestion. That was the fix for my issue.

  6. Petra Bos May 30, 2017 at 11:33 pm - Reply

    Doesn’t work for me ;-(

    • Warren Chandler July 17, 2017 at 6:13 pm - Reply

      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.

  7. Cesar Elo August 7, 2017 at 8:30 am - Reply

    Thank you very much. Fixed it!!!!!!

Leave A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.