I have created a flow that I want to use to tag an order depending on the stock level of the variant at the time of the order. We allow customers to order when we have no stock but I want the order to be tagged so that we know if the item is in stock or requires to be made.
I have set up the flow but I just had an order and it tagged the order incorrectly.
Im not sure how to troubleshoot this but if someone can help that would be great.
Can’t test it as we don’t sell out of stock but this should be closer to what you need as your not telling the flow to check every item in the order:-
It looks like it sees the inventory stock at 0 for the item when it should have been 1. Could it be that its checking the stock after the order goes through?
It runs after an order is created. I’d expect that part of an order being created it removing the stock from the store, so that the next order see’s a more accurate count.
Yeah it’s after the order is created. So ive adjusted the calculation to trigger when stock drops below 0 of any item on the order. Hopefully that picks it up.
Did adjusting when the calculation triggers help this work for you? Can you please explain how/where you made that adjustment if it did work?
Our store is running into a similar issue, where we want to confirm that there is enough available inventory to cover the ordered quantity of each line item. As you found, it’s clear that stock is being checked after the necessary quantity has been allocated for the order, which is not particularly helpful in this situation.
This is what our condition looks like – it’s using product instead of variant, but I think we’re essentially looking for the same kind of result:
I had the idea to add the quantities for each of those variables (lineItems_item.quantity and lineItems_item.product.totalInventory) and then compare that to lineItems_item.quantity – if the sum of the two is greater than or equal to the value of lineItems_item.quantity then inventory at the time of the order should have been adequate – but I’m pretty sure that would require javascript in a Run Code action, which is a bit beyond my abilities.
Yes I managed to get it to work by basically doing the test after the sale. So if the stock amounts fell below 0 then I knew I needed to make things and could add then add the correct tag.
Ah, got it. Unfortunately I don’t know if that will help with our situation, but I appreciate the info nonetheless. Maybe I can adapt the idea to the issue we’re trying to work around.