TL;DR: When I was troubleshooting a WooCommerce site with a variable product an empty price field lead to the product displaying as “out of stock”.
Today I encountered an error when on a WooCommerce site; a product that was in-stock displayed as out of stock when I viewed it. WooCommerce allows you to create variable products. Variable products are products that are mostly the same but have small variations, for example, colour or size.
After adding variations to the product, on the product page it displayed a notice saying that “This product is out of stock and is unavailable”. After that, I went and checked all of the individual variants stock status and all of them did have “in stock” selected as a stock option. I then went to the “All products” page and checked the stock level there. Once again, the products displayed as “in stock”.
Feeling frustrated I tried changing the stock status to “out of stock” and back to “in stock”. Still no change 🙁
With the release of WordPress 5.0 around the corner, I wondered whether I had found a bug. I had another look at my products page and saw that the price field was blank. I added the price for all of the variants, and this resolved the error.