Flow to reallocate order to new fulfillment location

Topic summary

Goal: Automate reassigning an order’s fulfillment to another location that has stock when the originally assigned location can’t fulfill (e.g., insufficient quantity or unexpected loss), ideally limiting reassignment to locations with available stock.

Key considerations:

  • Some merchants may want to exclude certain locations (e.g., retail), though the requester is fine including all locations if they have stock.
  • Detection scenarios include: location has fewer units than ordered, or inventory marked present but item is actually unavailable (e.g., stolen).

Proposed approach:

  • Use the “Order ready to fulfill” trigger in Shopify Flow. This runs per fulfillment order (location) when it moves to “open,” ensuring locations are assigned first.
  • Because fulfillment orders don’t expose variant data directly, query product variants by iterating line item SKUs to retrieve inventory info (code snippet provided).
  • Condition currently checks if location quantity > 0. It does not yet compare against the ordered quantity; additional logic would be needed.

Status and gaps:

  • A tested prototype “seems to work,” though API complexity is noted. Screenshots and a code snippet are central to understanding.
  • Open items: handling ordered-quantity checks, optional location exclusions, and reliably signaling “can’t fulfill” beyond the trigger.
Summarized with AI on January 1. AI used: gpt-5.

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)

1 Like