Product_visibility outofstock tag
-
Hi @jamesgol,
I’m trying to change the “product_visibility” taxonomy every time the product goes out of stock, or in stock. This is so out of stock products won’t be displayed at the shop, and only in stock products are displayed.
Currently, the plugin seems to only set the product stock status to “out of stock”, but doesn’t add the “outofstock” tag to “product_visibility”, which causes the product is still being displayed, but with some errors.
EDIT: Forgot to tell you, I set “hide out of stock products” enabled at WooCommerce, so that’s why the errors pop up when an out of stock product being displayed. Currently using WooCommerce 3.4.4.
Can you tell me where I can insert my code to do this?
wp_set_object_terms( $id, 'outofstock', 'product_visibility', true );
Thanks,
Dicko
- The topic ‘Product_visibility outofstock tag’ is closed to new replies.