NO BUG: No stock information shown for out of stock items

On my Woocommerce single product template I use the Add to Cart element to show the Add to cart button, quantity input field, stock availability and variations selectors if present.

For a variable product, no stock information is shown before a variation is selected (obviously). When a variation is selected that has stock, the quantity in stock is shown (“ex. “4 is stock”).

However when a variation is selected which has no stock, no information is shown (so it’s ambiguous whether the product has stock available or not). Should it not show some text, (ex. “Sold out” or “0 in stock”) when there is no stock available for a variation?

Hi Eric,
Thanks so much for your report!

Correct. That’s how it is in the „official“ storefront theme.

If the variation is out of stock, “Out of stock” is displayed above the add to cart button/quantity input after selecting a variation. This behavior is also identical to the storefront theme.


If you always want to show an "Out of stock" notice for your variable products - i.e. regardless of the variant selection - you can use the product stock element or the `{woo_product_stock}` dynamic data tag. In both cases, you can use a condition to display the status only for variable products (see screenshot).

Best regards,
timmse

This is not happening but perhaps it’s because most products are set to “allow backorder” which means they are never really out of stock?

Yep, that seems to be related somehow. But this is also a WooCommerce standard (Storefront theme).
If you allow backorders, it is irrelevant that the stock is 0. The customer can still order the product.