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 targets
Anchor link to section titled "Extension targets"The Order Routing Location Rule API exposes the following targets:
Target | Output type | Description |
---|---|---|
purchase.order-routing-location-rule.run |
FunctionRunResult | Outputs the list of ranked locations |
The RunInput
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:
FunctionRunResult
Anchor link to section titled "FunctionRunResult"The FunctionRunResult
object is the expected output for the purchase.order-routing-location-rule.run
target.
The following function result ranks locations:
Combining fulfillment groups ranked locations from multiple functions
Anchor 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.