Can you please add inventoryBehaviour todraftOrderComplete?
The last time I checked these APIs were not respecting continue selling when out of stock deselected in the product.
Hey @madfcat, assuming you’re exploring draft orders as an alternative to orderCreate (as per the other thread)?
Draft orders will decrement automatically when the order is complete. The general advice when working with draft orders is to validate inventory first.
For example, the same is possible in the admin when creating draft orders for items out of stock, but there will be a small warning:
For context, the reason orderCreate has this option as that endpoint is typically for creating records of an order already completed, so most cases the inventory shouldn’t be adjusted; whereas draft orders are for merchants to create manual orders for merchants to later purchase or complete.
Just to confirm my understanding: it is impossible to not oversell with completing draft orders?
From my understanding:
Checking the inventory and completing a draft order will lead to a race condition between instances of the same app when scaling horizontally + other sales channels in the Shopify itself will also will participate in this “race”.
Longer-term, it seems to be beneficial if the transactions and the stock checks were implemented in Shopify APIs itself not allowing to oversell or respecting the inventoryBehaviouroption.
That is true, however you can prevent overselling if you use reserveInventoryUntil when you create the draft order, that inventory won’t be available to be purchased on another non-draft order.
Good point but not exactly what I am looking for ![]()
