Hi, I’m trying to find a way to split up fulfilmentOrder for a line item in a Shopify order.
An example situation would be:
Shopify store has multiple locations, call them location A (default) and location B, and the store is set to track inventory at locations.
A product is created in the store with 1 inventory quantity in both A and B, totalling of 2 items across all locations.
A customer purchases the item with quantity 2 from the online store
As according to the behaviour set out in this documentation, the line item is being set to location A for both quantities, even though location A only has 1 (because neither A nor B has 2 of the said item)
This results in location A’s inventory to go -1, and location B to stay at 1.
In the above scenario, the said order will have a fulfilmentOrder attached to it for the line item to be fulfilled at location A. What I wanted to do is to actually split it out (via GraphQL API) so that 1 is assigned to location A and the other to location B, resulting in both locations having 0 inventory at the end and none having negative inventory.
The only GraphQL mutation I can find that might be relevant is fulfilmentOrderMove, but it does not allow splitting an existing fulfilmentOrder. Does anyone know how to achieve this? Many thanks!
In the scenario you described, the recommended workflow is to first create a fulfillment for 1 unit at the assigned location. Once the fulfillment is created, the existing fulfillment_order will have it’s fulfillable_quantity updated to 1, at which point it can be moved to the new location using the fulfilmentOrderMove mutation.
Hello, JB can you explain me how to create this fulfillment, because I can see Shopify creates the fulfillment automatically when an order is created, but can’t find how to create one with the rest API
A very important detail is that the id on “fulfillment_order_line_items” is not the line_item id from order endpoint but the one you get from the array line_items from the result of calling this endpoint: /admin/orders/ORDER_ID_XXXX/fulfillment_orders.json