HBN Notes / Shopify guide
How to block ZIP codes and postal codes on Shopify
Set postal-code delivery boundaries or block checkout by ZIP code, with Shopify Plus requirements, setup steps, and allowed and blocked examples.
Published
To restrict orders by ZIP or postal code on Shopify, first decide what should happen outside your service area. Local-delivery postal zones control who sees that delivery option. A checkout validation rule blocks an order and asks the shopper to change the address or cart.
A carrier's remote-area exclusion, a supplier restriction, and a local van route can require different settings. Start with the delivery policy and affected products, then choose the method that enforces it. A postal match does not verify that an address exists or check live carrier coverage.
Choose between local-delivery coverage and a checkout block
- Offer local delivery to selected postal codes: configure postal zones for the location that delivers the order. An address outside those zones can still qualify for another shipping method.
- Manage ordinary shipping coverage: review the shipping zones and rates for the relevant products and destinations. Standard shipping zones group countries or regions; they are not a postal-code block list.
- Prevent checkout for an unsupported postal address: use address validation with a clear blocked-code or permitted-code policy. Shopify's Checkout Blocks workflow below requires Shopify Plus.
Do not use a checkout block to repair a missing rate. If the destination should be serviceable, fix the delivery profile, zone, or carrier setup instead of teaching customers that a valid area is forbidden.
Set a postal-code area for Shopify local delivery
In Shopify admin, open Settings → Shipping and delivery → Local delivery and select the fulfillment location. Enable delivery from that location, choose postal-code zones, and add the codes your team serves. Set the delivery charge and any minimum order value, then save. Shopify's local-delivery instructions explain postal formatting and other eligibility requirements.
Test an address inside and outside the zone. This controls local delivery; it does not prohibit a customer from choosing an otherwise available shipping option.
Block postal codes with Checkout Blocks on Shopify Plus
Shopify's Checkout Blocks plan requirements reserve this validation feature for Plus. Basic and higher plans can use certain content blocks on Thank you and Order status pages, but that access does not include postal-code checkout validation.
- Open Checkout Blocks from Apps. Under Functions, create a function and choose Address format validation.
- Name the rule. Set its market scope if the restriction applies only to particular destinations.
- Enable the ZIP/postal-code check. Choose whether the listed codes are blocked or required, then enter the codes separated by commas.
- Add a short customer message where the rule supports one. Explain the accepted correction, such as using another delivery address.
- Save the rule, change its status to Active, and save again. Verify a blocked and an accepted address in a test checkout.
The official
address-format validation guide
also documents wildcard matching, such as 100** for ZIP codes
10000–10099. That syntax belongs to this tool; check the matching rules before
copying a pattern into another app. These rules validate shipping addresses,
not billing addresses.
If Checkout Blocks is unavailable on your plan, evaluate a public validation app that supports your store's checkout and required postal rules. For product-specific scope or numeric postal ranges, HBN: Address Rules provides scoped address policies. Its Free plan covers one store-wide rule; product-specific scope and multiple policies require Pro.
Check a blocked-code example before adding patterns
Suppose one hypothetical policy blocks US ZIP codes 10001 and
10005 for all products. Start with exact matches and record what
this one policy should do:
Scroll horizontally to see the full test cases.
| Test address | Expected result | Reason |
|---|---|---|
| US, 10001 | Blocked by this policy. | The code is on the blocked list. |
| US, 10005 | Blocked by this policy. | The second listed code must behave the same way. |
| US, 10002 | Not blocked by this policy. | A nearby code is outside the exact list. Other checkout requirements still apply. |
Then change a blocked address to an accepted code and retry checkout. Passing this rule does not establish that stock, shipping rates, or every other checkout rule will allow the order.
Turn the service boundary into the least surprising match
An exact list works for a small number of known codes. A prefix is easier to maintain when every code beginning with the same characters shares the same outcome. A numeric range is appropriate only when both endpoints and every value between them belong to the same service area. These forms are not interchangeable.
Keep country context with the rule. “2000” can describe different places in different postal systems, and letter-and-number postcodes should not be forced into a numeric range. Preserve leading zeros, spaces, and significant letters when the tool expects them. For an allowlist, remember that omission becomes a block: a newly supported code will remain unavailable until someone adds it.
Product scope needs the same discipline. If only refrigerated items or one supplier's products have the limitation, a store-wide postal rule is broader than the fulfillment problem. Define the product group first, then test it using the product-specific restriction matrix.
Test the seams, not just one obvious blocked code
For a hypothetical inclusive range from 10001 through 10005, a useful test set is 10000, 10001, 10003, 10005, and 10006. That proves both boundaries, an interior value, and the nearest allowed values. For a prefix, try a code that shares only the first few characters and another with different spacing or case where the postal system allows it.
- Test one blocked code and one accepted code in the same country.
- Try a code that looks similar in a different country.
- Check the exact endpoints of every range.
- Test a matching and non-matching product, then put both in one cart.
- Correct the address and retry the final order action with test payment.
A simulator can make isolated rule checks faster, but it cannot prove every mixed cart, split delivery, saved address, or accelerated checkout path. Keep at least one complete test checkout in the launch checklist.
Write a message that distinguishes policy from address accuracy
“Invalid ZIP code” is misleading when the code is real but outside your service area. Use the reason the shopper can act on: “This item is not available for delivery to this postal area. Use another delivery address or remove the item.” If removing the item would not solve the problem, do not offer it as an option.
Keep the source list, owner, and review date beside the rule. Carrier coverage, supplier boundaries, and local-delivery areas change. A technically correct postal match can still become an outdated business decision.