Currently in woocommerce, add to cart button disabled, if the stock status is out of stock
. I add new stock status with the label Discontinued product
by using woocommerce_product_stock_status_options
, now I am looking for a way to treat this product like it is out of stock.
Since I believe it is better to separate between a product that is not produced anymore and a product that produced and available in another store but it’s not in stock.
2
Answers
You can use the following to disable add to cart button based on a custom stock status (where you will replace
custom_status_slug
by your custom status slug):Code goes in functions.php file of the active child theme (or active theme). Tested and works.
I propose a solution that displays the stock status on the product page but not the ‘add to cart’ button
Thanks for the first answer 🙂