Set custom status based on stock qty?

Top WooCommerce & WordPress Plugins Forums Order Status Rules for WooCommerce Set custom status based on stock qty?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #85592
    Numan Golukcu
    Participant

    Hello, is it possible to set custom status based on stock qty? For example i want to set a order status for a product which I have more than 1000 pieces in stock and on the other hand I would like to set a custom order status for a product which only left 5 pieces left in the stock. I was thinking it could help with order meta field via “_stock” and I could add ”>” or ”<” on the value section?

    Thank you

    Numan

    #85593
    Tom Anbinder
    Moderator
    Plugin Support

    Hi Numan,

    I believe this is doable. However, I don’t think that WooCommerce stores product stock in order meta – we need to use product meta instead. So in your case, we need to add a PHP snippet to your site. If that’s ok – there is the alg_wc_order_status_rules_do_apply_rule filter in our plugin. It allows you to customize the conditions of when the rule should be applied. So you need to add a simple rule, e.g., Rule #1 / Status from: Processing / Status to: Completed. And finally, add this snippet to your site (“Example #3: Check if the order has any products with stock quantity lower than or equal to 5”).

    Please give it a try and let me know what you think.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.