If all variations are out of stock I want to hide a product.
In WooCommerce if you click the box "hideout of stock items from the catalog" it hides specific variations that are out of stock. It looks weird when a shirt is just showing sizes Small and Large. This is not what I want.
I want to show all variations unless ALL variations are out of stock – then I want to hide the product.
2
Answers
You can use the
woocommerce_product_query
action hook to remove a product if all variation isoutofstock
. code will go in your active theme functions.php file.Few easy steps to Hide Out of Stock Products