Order Routing Location Rule API reference
Order routing is the process of determining the location that's used to fulfill each cart line item. The Order Routing Location Rule API allows developers to provide their own ranking of location, for each item, during order routing.
Extension targetsAnchor link to section titled "Extension targets"
The Order Routing Location Rule API exposes the following targets:
||FunctionRunResult||Outputs the list of ranked locations|
Input object is the complete schema that your function can receive as input.
For a list of fields that the Order Routing Location Rule API's
Input object accepts, refer to Input.
The following example shows an input query:
The following example shows the resulting input to the query:
FunctionRunResultAnchor link to section titled "FunctionRunResult"
The following function result ranks locations:
Combining fulfillment groups ranked locations from multiple functionsAnchor link to section titled "Combining fulfillment groups ranked locations from multiple functions"
For each fulfillment group, Shopify first sorts the output of each function based on the
locationRule priority. Shopify then takes the first output, and sorts the locations of the fulfillment group based on the rank. If there are ties between the rankings, then Shopify breaks them using the ranks from the second output, and so on. If there are no ties, then only the output of the first
locationRule is considered.