Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.

I have more than one fulfillment location but I need one of them to be zip code restricted.

rcamargo
Shopify Partner
3 0 0

Hello, 

 

I have quite a unique use case that I can't seem to find an answer too in the docs. I created an app that creates a fulfillment location for any store that installs it. However, I want the fulfillment location that I created (via an app install) to be zip code restricted. I have seen other apps be able to make their stores zip code restricted but wondering if I can make just one fulfillment location zip code restricted, not the entire store. 

 

A store might have one fulfillment warehouse location that will ship anywhere domestically. But I want to have another fulfillment location (via my app install) that can only fulfill orders from a select range of zip codes. 

Is this possible? 

Replies 2 (2)

Liam
Shopify Staff
2677 288 737

Hi Rcamargo,

 

From looking into this, it doesn't seem as though there's does no native API functionality to directly restrict fulfillment locations based on zip codes. Fulfillment locations in Shopify are designed to manage inventory across different physical locations and are not inherently linked with specific delivery zones or restrictions. However, you can build a workaround in your app that handles this. Here’s one general approach to do it:

  1. When an order is placed, you can use the Order API to query the shipping address of the order.

  2. In your app, maintain a list of zip codes that your fulfillment location can serve. Once you receive the shipping address, check if the zip code of the address is in your list.

  3. If the zip code is in your list, you can proceed to fulfill the order from your location using the Fulfillment API. If it isn't, you can use the orderUpdate mutation to update the location_id of the line items to a different location that can fulfill the order. There's also an Order Routing Location Rule API which is in beta that you could also use for this purpose. 

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

GhostApps1
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