Setting up order routing
Order routing automatically routes orders to fulfillment locations based on a set of routing rules. You can use the default Shopify settings or further refine your order routing based on your business needs.
Order routing is available in Shopify after you set up 2 or more active locations. It uses rules to determine the locations to use to fulfill each item in a customer order. By adding, removing, and rearranging rules, you can determine how locations are prioritized.
On this page
How order routing works
Order routing works by applying a series of rules to an order and then prioritizing locations based on the results. The locations with the highest priority ranking are selected to fulfill the order.
By default, rules are configured to optimize for fulfillment from the closest location within the destination market that has all of the items in the order in stock. There’s no need to modify your order routing settings if the default settings work for your business.
Routing rules
You can use the following four rules to customize your order routing strategy.
Rule | Description |
---|---|
Minimize split fulfillments |
Optimize for fulfilling the order in the fewest number of packages. Locations that have all items in stock are prioritized over those that don’t. When none of your locations have all of the items in stock, this rule will prioritize the locations that result in the fewest number of packages. |
Stay within the destination market | Locations within the same market as the shipping address are prioritized. Learn more about International |
Ship from closest location |
The location closest to the shipping address (measured in a straight line using the Haversine formula) will be prioritized. The Ship from closest location rule functions as a tiebreaker and will always select the location closest to the destination address. For best results, this rule should always be the last rule applied. If there are two locations that share the same address, then the older of the two (based on the date they were added to Shopify) will be prioritized. |
Use ranked locations |
Prioritizes locations using a group-based ranking that you define for your business. For example, if you want your warehouses to be prioritized over your storefront locations, then create a location group for all of your warehouses and another location group for all of your storefronts. Locations in the first group will be prioritized over locations in the second group. Locations in the same location group share the same rank. For example, all of the locations in the topmost location group share a ranking of 1, whereas all of the locations in the second location group share a ranking of 2. |
Configuring routing rules
Rules can have an associated UI (user interface) extension that allows you to configure the parameters of the function execution by using metafields.
In the Shopify admin, rules with an associated UI extension have the following differences from those that don't:
- Rules can be added more than one time to a strategy.
- Rule configuration is triggered by the pencil icon in the rule.
- Rule labels can be changed.
Routing rule extensibility
Including the default rules, order routing rules are implemented as Shopify Functions.
It's possible for third party developers to implement and contribute their own custom location rules.
Every rule other than the default rules that are listed in the Routing rules section should be considered a custom rule.
Custom rules can be identified in different ways:
- In the Shopify admin, with the icon of the app that provides them for rules in a strategy.
- In the Shopify admin, with the icon and name of the app in the Add Rule modal.
- In GraphiQL, with the
shopifyDeveloped
field of the app associated with the rule.
Example order routing
Rules run from top to bottom, and each rule is applied to the results of the previous rule. The final result determines which locations fulfill the order. The following is an example of how order routing rules are applied:
First, a customer places an order with a New Jersey shipping address. The store has 4 locations that can potentially fulfill the order: New York, Vancouver, Miami, and Texas.
The order routing rules are configured to be applied accordingly:
- The Minimize split fulfillments rule is applied. New York, Vancouver, and Miami have all of the items in stock, so they continue to the next rule. Texas does not.
- The Stay within the destination market rule is applied. The order is being shipped to an address in the United States, so New York and Miami continue to the next rule. Vancouver does not.
- The Choose closest location rule is applied. New York is closer to New Jersey than Miami, so New York is prioritized and Miami isn't.
- The order is assigned to the New York location.
Add an order routing rule
From your Shopify admin, go to Settings > Shipping and delivery.
In the Order routing section, click the › icon.
Click Add rule.
Click a rule that you want to add.
Click Save.
Edit an order routing rule
From your Shopify admin, go to Settings > Shipping and delivery.
In the Order routing section, click the › icon.
Click the pencil icon next to the order routing rule that you want to edit.
Make the edits to your order routing rule, and then click Done.
Click Save.
Rearrange the priority of your order routing rules
From your Shopify admin, go to Settings > Shipping and delivery.
In the Order routing section, click the › icon.
Click and drag the ⠿ icon next to an order routing rule, and then move the rule to adjust the priority.
Click Save.
Remove an order routing rule
From your Shopify admin, go to Settings > Shipping and delivery.
In the Order routing section, click the › icon.
Click the trash can icon next to the order routing rule that you want to remove.
Click Save.
Common configurations
The following are suggested configurations for order routing rules. You can follow them to set up rules that meet your store's needs.
Always ship from the closest location
If you prefer shipments to always ship from the closest location, even if it means splitting up the order into multiple packages, then use the Ship from closest location rule on its own.
Steps:
From your Shopify admin, go to Settings > Shipping and delivery.
In Order routing section, click Manage.
Click Add rule.
Click Ship from closest location. If this rule is greyed out, then it means that it’s already active in your configuration.
Click the
x
icon on any other rules in the configuration until only the Ship from closest location rule remains.Click Save.
Prioritize your closest warehouse location
If you have some locations that should ship orders first, such as a third-party logistics service or warehouse, then rank those locations above your non-warehouse locations.
Steps:
From your Shopify admin, go to Settings > Shipping and delivery.
In Order routing section, click Manage.
Click Add rule.
Click Use ranked locations.
Click ⠿ and drag to move the rule to the top of the list.
On the rule, click the ✎ pencil icon to open the configuration modal for the rule.
Drag warehouse locations to the topmost location group. Leave any locations that shouldn't be prioritized in the bottom location group.
Click Done.
If you have multiple warehouse locations, then add the Ship from closest location rule at the end to break any ties.
Click Save.
Frequently asked questions
Is order routing the right place to define overselling behavior?
No, overselling behavior remains the same and it’s configured at the product level. Learn more about tracking inventory
Can I set up restrictions to avoid shipping to certain locations?
Not using order routing, but you can set up shipping restrictions by setting up shipping profiles.
Can I combine rules in any way I want?
Yes, you can add, remove, and rearrange rules as you need them.
Will I lose sales if I don't set up the right configuration?
No, order routing won't prevent you from selling your products. If the configuration isn't optimal, then orders might be shipped in more boxes or be assigned to a location that is further away.
Will my order routing configuration overwrite my current shipping profiles?
No, shipping profile configuration isn't affected by order routing.