To block Shopify orders by ZIP code or postal code, create a checkout validation that compares the shopper's delivery postal code with a list or pattern of excluded areas. If the address matches, block checkout and show a message that explains the restriction and any available alternative.
This is more precise than blocking an entire country or market. It can help stores enforce carrier exclusions, local delivery boundaries, regulated sales areas, or temporary service gaps without turning away shoppers in supported regions.
If the policy applies to selected products across an entire region, use the separate guide to state or province product restrictions. For broader international rules, see how to restrict Shopify products by country.
The workflow is: define the excluded codes, configure the narrowest match, write a useful error, then test blocked, allowed, and formatting variants.
Last verified: September 14, 2026. CartBlock current builder shows Zip code with Any, Not any, Partially contains, Partially does not contains, Starts with, Ends with, Not starts with, and Not ends with. Automatic normalization is not documented.
When should you use a postal-code rule?
Use a postal-code restriction when the policy is truly geographic and the delivery address is the right source of truth. Common examples include:
- A carrier does not serve remote postal codes.
- Same-day delivery covers only part of a city.
- A fragile product cannot ship to an offshore or hard-to-reach area.
- Local regulations prohibit delivery in selected districts.
- A temporary disruption affects a narrow service area.
Do not use the rule as a substitute for accurate shipping rates. If you can serve the area with a different carrier or a higher rate, update the shipping setup instead of blocking the order.
Define the ZIP or postal codes before configuring Shopify
Start with a written policy. Record the country, code format, matching behavior, affected products, and exception owner.
| Policy field | Example |
|---|---|
| Country | United States |
| Blocked codes | 99501, 99502, 99503 |
| Matching rule | Exact match after spaces are removed |
| Scope | Frozen products only |
| Shopper option | Remove the item or use another address |
Postal-code formats differ by country. Some contain letters, spaces, or leading zeros. Store codes as text, normalize spaces and letter case, and do not convert them to numbers.
For example, US ZIP 02108 must remain text or its leading zero can disappear. Canadian K1A 0B1 may be entered with or without the space. Include each accepted form in rules and tests because normalization is undocumented. Prefixes are jurisdiction-specific.
How to block Shopify orders by ZIP code with CartBlock
CartBlock can validate or block orders with configurable conditions. The instructions below use labels visible in the current rule builder.
1. Create a checkout validation
Open CartBlock in Shopify admin and create a validation. Use an internal name that states the scope, such as Block frozen delivery to excluded ZIP codes.
2. Choose the delivery postal-code input
Select Zip code, described in the builder as checking ZIP codes provided in the shipping address.
3. Add the blocked codes or pattern
Enter excluded codes and choose the narrowest verified operator. Use Any for listed full codes and Starts with only when every code beneath that prefix is excluded. Reserve Partially contains for policies that genuinely require substring matching.
Broad substring matching can block unrelated locations. For example, a rule intended for 123 should not match every code that merely contains those digits.
4. Limit the rule to affected products when needed
The supplied UI evidence does not verify a product, variant, or collection selector. For product-specific policies, confirm that scope in the installed builder before launch.
5. Write an actionable error message
Tell the shopper what failed and what they can do:
We cannot deliver frozen items to this postal code. Remove the frozen item or enter another delivery address to continue.
Avoid blaming the address or promising service in an area that has not been approved.
6. Save and test the rule
Test the rule in a controlled checkout before relying on it. Include codes inside and outside the restricted area, formatting variations, and accelerated checkout paths.
Postal-code validation test matrix
| Test | Expected result |
|---|---|
| Exact blocked code | Checkout blocked |
| Allowed neighboring code | Checkout allowed |
| Code with optional space | Same result as normalized code |
| Lowercase letters | Same result when matching is case-insensitive |
| Leading-zero code | Leading zero preserved |
| Blocked code without affected product | Checkout allowed |
| Cart with affected and unaffected products | Policy and message behave as written |
| Address edited during checkout | Rule reevaluates the new address |
Shopify notes that a checkout can contain more than one delivery group. Test mixed carts and split delivery when your store supports them.
Common postal-code rule mistakes
Using shopper location instead of delivery address
IP location and browser location can differ from the delivery destination. Use the delivery address when the policy concerns where the order will be shipped.
Blocking a prefix that is too broad
Review every code covered by a prefix. An efficient-looking pattern can exclude valid customers if the regional code system is not hierarchical in the way you expect.
Forgetting pickup and digital-only carts
A shipping postal-code rule may have no relevant address on a pickup or digital-only checkout. Decide how those carts should behave and test them separately.
Letting the list become stale
Assign an owner and review date to carrier and regulatory exclusions. Remove temporary restrictions as soon as service returns.
Frequently asked questions
Can Shopify block a single ZIP code?
Yes. Shopify supports cart and checkout validation, and CartBlock exposes a shipping-address Zip code condition. For one full code, use Any, enter the code as shoppers submit it, and test spacing, case, and leading-zero variants.
Should I block a ZIP code or remove its shipping rate?
Remove shipping availability when no shipping method should serve the area. Use validation when the restriction depends on other cart conditions, such as a particular product or customer type.
Can I show a different message for each region?
That depends on the current CartBlock configuration. If separate rules are supported, use messages that name the relevant restriction without exposing internal policy details.
Enforce the smallest useful location rule
A reliable postal-code restriction uses the delivery address, preserves each country's code format, and gives the shopper a way to recover. Explore CartBlock on the Shopify App Store and verify the current address conditions before activating the rule.

Install Now