Order routing not respected when creating order through API

Shopify Partner
4 0 0



I implemented a specific order routing système in order to fulfilled the order from the good location.

When I create an order from the shopify dashboard, routing rules are used. However, when I create an order from API, the default location is always selected, meaning that routing rule are not used to determined the good location.


What can I do ? 

Thank you

Replies 2 (2)

Shopify Staff
2731 302 782

Hi Ben,


When creating an order through the API, Shopify's built-in routing rules are not used by default. Instead, the location from which the order is fulfilled is determined by the location_id value that you specify when you create a fulfillment through the API.


If you want to use Shopify's built-in routing rules when creating an order through the API, you'll need to use the FulfillmentOrder resource. This resource allows Shopify to determine the best location for fulfilling an order based on your routing rules.


Here's how you can do it:

  1. Create the order using the Order API, but do not specify a location_id.
  2. Next, retrieve the order's FulfillmentOrder objects using the FulfillmentOrder API. Each FulfillmentOrder object represents a group of items in the order that should be fulfilled from the same location.
  3. For each FulfillmentOrder, you can then create a fulfillment using the Fulfillment API. Shopify will automatically select the best location based on your routing rules.

You can check out our dev docs here for more details on using this resource. 


Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Shopify Partner
33 0 0

Hi Advanced Fulfillment Rules can do this, you can target the country, state or zip code. It can also split orders between warehouses and select the warehouse closest to the delivery address.