Decrease/increase the stock inventory

Top WooCommerce & WordPress Plugins Forums Stock Triggers for WooCommerce Decrease/increase the stock inventory

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #85918
    blankRachele
    Guest

    Hi Tom,
    thank you very much for your job! I’m writing you to know if your plugin (PRO version) could help me with my website.
    We build a plugin named “biofood” that works with a custom order status, named “pedido_solicitado”. This custom order status keeps the orders open until Sunday night, to allow people to add or subtract products until a certain date (without changing the status of the order). The process is: I choose a product, the product go to a temporary cart, I leave my credit card and finalize the purchase, the product go to a van. If I leave the page and I come back to it before Sunday I can repeat the process. In the cart I have the products I’m buying at the moment, in the van I’ve the products I’ve already bought. On Sunday night the order status changes automatically to On hold and the van come back empty. I need to decrease/increase the stock inventory when clients put/take off products in/from the van. Is it possible to use a trigger that do that? Thank you for your answer, and sorry for my bad english…

    #85919
    blankTom Anbinder
    Moderator
    Plugin Support

    Hi Rachele,

    Sorry for the late reply.

    Yes, I believe the plugin can do this. There are “Custom triggers” options in the pro version – we can associate any trigger with decrease/increase order stock actions. The exact trigger will depend on your “biofood” plugin.

    Hope this helps. Please let me know if you’ll have any questions.

    #85920
    blankRachele Lo Piano
    Participant

    Hi Tom,

    I finally bought the plugin and I’m trying activating some custom triggers.

    I added a:

    add_action( 'some_action', 'some_function', 10, 0 );

    and then, in the point I want to execute it:

    do_action( 'some_action' );

    … but it’s not working. Do you have some documentation about how to make the custom triggers work? Could you help me with some tips?

    Thank you and best regards,
    Rachele

    #85921
    blankTom Anbinder
    Moderator
    Plugin Support

    Hi Rachele,

    Sorry for the delay. Your custom action must pass order ID as an argument. I.e., if you have this in your code:

    do_action( 'some_action', $order_id );

    then you need to set the “Custom triggers” option in our plugin settings to:

    some_action

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

    #85922
    blankRachele Lo Piano
    Participant

    Hi Tom,

    I send you a message answering your e-mail last Thursday, but I didn’t receive any answer. So I will send you the message here again.
    Using The order ID’s argument the sock trigger is working (without pre tag) but I cannot get the way it decreases stock.
    1) when the decrease happens for an order happens only once for order, so If I call the trigger after for a second time it doesn’t decrease a second time?
    2) all the product in the order are decreased? There is a way to tell it to trigger only on some product in the order? If I add some product I do not want the stock to be decreased for all the item in the order.
    3) If I remove the standard woo commerce trigger, how it works in the admin area? If I trash an order the stock is still managed or not?

    I have actually a custom bit complicated system which any time an order is put, removes the order created and put items in a custom unique order for each customer. I’m trying to manage stock but it’s a bit difficult for in my flow the order A gets created (stock decrease), the order A get trashed (the stock increase), the item of the previous order are put in the unique already existent order B and in this case I should decrease the stock of the unique order B for the items added.

    Thank you so much for your help.

    #85923
    blankTom Anbinder
    Moderator
    Plugin Support

    Hi Rachele,

    I did reply to you on Friday. Maybe it ended up in spam? Anyway, here is my reply:

    1. Yes, that’s correct. When order stock is decreased, the order is marked as “stock decreased”, and it will not be decreased for the second time (unless you increase it again before that, for example, by setting order status to canceled). This is the default WooCommerce behavior (i.e., this is not done by our plugin).
    2. Yes, when we call the “maybe decrease stock” function (again, this comes from the WooCommerce itself), it will check if the order is not marked as “stock decreased”, and if it’s not – it will decrease stock for all the products in the order.
    3. Not sure if I got this correctly. It’s quite straightforward – for example, if you remove the standard “decrease stock on order completed” trigger, it will not decrease the stock when the order status changes to “completed”. And about “trash an order” – as far as I know, by default in WooCommerce, if you trash some order for which the stock was decreased, it will not increase the stock.

    Hope this helps, and please let me know if you have any questions.

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