A merchant with two locations (Store and Warehouse) wants to automatically reassign “Store Pickup” orders from Warehouse to Store when Store has sufficient inventory.
Current Setup:
Orders default to Warehouse (shipping origin) when inventory is available
Store Pickup orders should route to Store location if inventory permits
Need to verify Store inventory levels before moving fulfillment orders
Proposed Solution:
Use Flow’s “Move fulfillment order” action to reassign locations
Trigger: “Fulfillment order ready to fulfill” (avoids looping issues)
Check conditions: assigned location is Warehouse AND shipping method is store-pickup
Key Challenge:
Comparing line item quantities against Store location inventory requires checking two data lists simultaneously. This necessitates using Flow’s “Run code” action rather than standard conditions.
Current Status:
The merchant is stuck on implementing the inventory comparison logic. A GitHub example was shared (fulfillment-order-filter-line-items) as reference, but the merchant may abandon the project due to technical complexity.
Unresolved: No working code solution provided; implementation remains incomplete.
Summarized with AI on October 31.
AI used: claude-sonnet-4-5-20250929.
We have 2 locations (Store and Warehouse). Warehouse is our shipping origin so orders are assigned to this location as long as there is enough inventory (which is usually the case). But for orders with a shipping_lines title of “Store Pickup” we want to switch them to Store if this location has enough inventory to fulfil the order, otherwise leave it as Warehouse. On some occasions the order is assigned to the Store anyway if it’s the only location that has the inventory, in which case we would just skip it.
Yes, that should be possible. You could use the “Move fulfillment order” action in Flow. That will move the entire fulfillment order. If you need to move one or more items but not all, or items across multiple fulfillment orders, then you could call the API directly using “Send Admin API request” to split a fulfillment order and assign it to a new location
Thanks @paul_n . How would I determine whether the Store location has enough inventory to fulfil the order before using ‘Move fulfillment order’ to change the location for the whole order?
There are a few templates that show how to check location inventory. I’d install one and look at the path to the variables (you need to check both the name and available quantity). The path is roughly variant / inventory item / inventory levels / available and … location/name
An order has 0 to N fulfillment orders available at order / fulfillment orders. That action takes only one, so you either need a trigger that provides just one, or you can use For each to loop over order / fulfillment orders and then you can use that action inside the loop on the single fulfillment order.
That said, when an order is created, it has 0 fulfillment orders. They are assigned and then that triggers an fulfillment order ready to fulfill trigger for each fulfillment order that was made. So I would use that trigger, which will not require looping. The second option is to use a wait step after the trigger, something like 5 minutes. And then do the looping.
Thanks @paul_n . I am just getting around to looking at this again. I have changed the trigger to fulfillment order ready to fulfill, then run a check to see if the fulfillment order’s assigned location is Warehouse and the shipping line code is store-pickup (in which case we’d want to move it to Store if there is sufficient inventory at this location). What I’m struggling with is the next step: