Support » Plugin: WooCommerce Product Stock Alert » Change ‘manage stock’ state

  • Resolved crobrw

    (@crobrw)


    Hello,

    Great plugin, I use it on my website wich is in progress.

    I had custom code in function.php to update the ‘manage stock’ state in database.
    I’m talking about this checkbox : https://prnt.sc/20vb243 .

    I’m using this line to update state :
    update_post_meta($productId, ‘_manage_stock’, ‘yes’);

    My custom code is working, data change in database and checkbox is checked on product admin page but the form from shortcode is not displayed.

    It displayed only if we uncheck -> save product, check again -> save product.
    You can see the form here : https://prnt.sc/20vc97e

    I deduce that the form is only displayed if we check manually.

    Do you have an idea about how to display form in my case ?

    Thank you in advance,
    Regards.

    • This topic was modified 1 year ago by crobrw.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WC Marketplace

    (@wcmp)

    Hi @crobrw, somehow when you are updating the stock via code, it is not getting saved with the product. Please update the value only then the same will be reflected in the frontend.

    Thread Starter crobrw

    (@crobrw)

    Hello,

    It’s working by using wc_update_product_stock() to update stock in woocommerce after update_post_meta().

    Thanks for help ! Hope this will help someone else too.

    Regards

    Plugin Author WC Marketplace

    (@wcmp)

    Great To know that @crobrw 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change ‘manage stock’ state’ is closed to new replies.