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?
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:
When an order is placed, you can use the Order API to query the shipping address of the order.
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.
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,
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