Flow to reallocate order to new fulfillment location

Klavs
Tourist
3 0 1

Hi! It would be great if you could create a flow to reallocate an order to a new fulfillment location that has stock of the item when a fulfillment location can't fulfill the order and sets the order fulfillment on pause. 

Also if the flow could only reallocate to a fulfillment location with stock it would be awesome. 

Replies 5 (5)

paul_n
Shopify Staff
1010 133 240

I think that is possible, but there isn't a way to solve that for everyone. For example, you probably want to exclude certain locations regardless of inventory (like retail locations)

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
Klavs
Tourist
3 0 1

Hi Paul! Thanks - if you have a suggestion on how to do it I wouldn't mind if it included all locations - also retail locations - as long as they had stock of the item. 🙂

paul_n
Shopify Staff
1010 133 240

Sorry for delay...was on vacation..

 

Writing the condition first isn't going to help until you distill your problem a bit. I think I'd start with what would trigger the workflow. How do you know the fulfillment location can't fulfill the order?

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
Klavs
Tourist
3 0 1
I would know if the fulfillment location either has 1 item in stock, but they get an order of 2 pieces (even if you don't allow oversell the logic in Shopify would give a location the order for two items even though they can only fulfill one - we have talked to Shopify support about this). Or in another case - the store is set to have the item, but the item has been stolen and they therefore can't fulfill the order.
paul_n
Shopify Staff
1010 133 240

I think what you are saying there would suggest using "Order ready to fulfill" as the trigger, as it guarantees the fulfillment orders (and locations) have already been assigned. It runs per fulfillment order / location when it is moved to "open". 

 

I built at a quick test...this is fairly difficult because of how the API works for fulfillment orders. But I tested and it seems to work:

 

Query for get product variant data, which is needed because a fulfillment order doesn't have a way to directly access a variant:

{%- for lineItems_item in fulfillmentOrder.lineItems -%}
  (sku:{{lineItems_item.sku}}){% if forloop.last != true %} OR {% endif -%}
{%- endfor -%}

 

Condition panel...I'll note that I'm checking if the quantity at the location is > 0 and I'm ignoring how many things were ordered. If you want to check the ordered quantity against what's available, you could add more logic to this.

 

 

 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.