Shopify Flow is an ecommerce automation platform that enables you to automate tasks and processes within your store and across your apps.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
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.
Is this possible using Flow?
Thanks in advance.
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
Hi @paul_n, I am just having one issue with the 'Move fulfillment order' step - "FulfillmentOrder data not found".
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:
I cannot see a way to check if the quantity to be fulfilled is less than or equal to the available inventory at Store.
Given that you need to compare 2 lists of data (line Item quantity and location inventory), I think you need to use Run code.
Not sure when I'd be able to help. This repo has some examples but no perfect matches. Here's the closest https://github.com/Shopify/flow-code-examples/blob/main/run-code-examples/fulfillment-order-filter-l...
I'm going to struggle with this unfortunately so will probably just have to leave it for now! Thanks for the help @paul_n.