Restrict shipping methods by country, province, or postal code
Use ShipWith to control Shopify shipping methods by postal code, country, or province. Destination conditions can hide shipping methods or show only selected methods for specific regions. ShipWith changes delivery options that Shopify already provides; it does not create rates, change prices, or offer shipping discounts.
Choose the Function input
Choose Address input when one rule needs to combine country, province or state, and postal code conditions. Its description in ShipWith is Destination address fields for each delivery group, and all three destination conditions in this article appear in its condition picker.
The condition picker shows only fields supported by the selected Function input:
- Standard input, Customer input, and Address input show Shipping country, Province code, and Zip code.
- Attribute input shows Zip code, but not Shipping country or Province code.
- Shipping input does not show these destination conditions.
The current UI label is Zip code. It checks either a ZIP code or another postal-code format. Choose the Function input when creating the rule. It cannot be changed after the rule is first saved.
Read Choose the right Function input type for your rule before making this locked choice.
Set destination conditions
- Create a shipping rule.
- Choose Address input for Function input.
- Under When the rule runs, select When set conditions are met.
- Add Shipping country, then choose is one of or is not one of and select the countries.
- If needed, select Add condition (AND) and add Province code. Choose is one of or is not one of, then enter one code per line, such as
CAandOR. - If needed, add Zip code. Choose is one of or is not one of, then enter one postal value or pattern per line.
Conditions in one group use AND, so every condition must match. Use Add group (OR) for an alternative region. For example, one group can match United States with province code CA, while another matches Canada with province code ON.
Use province or state codes rather than full names. Matching ignores capitalization and surrounding spaces. Plain list entries are exact: 902 does not match 90210.
Use postal-code wildcards
For Zip code with is one of or is not one of, * matches zero or more characters. It can appear anywhere in an entry:
902*matches902,90210, and902ABC.*210matches values ending in210.90*10matches values that start with90and end with10.*matches any nonblank postal value.
The pattern is anchored to the whole postal value. 902* matches 90210, but not X90210. Matching ignores capitalization and surrounding spaces. An entry without * remains an exact match.
Wildcards apply only to these two list operators on Zip code. Other postal operators and other text fields treat * as normal text.
For regional alternatives, see Choose when a shipping rule applies: conditions and groups for how OR groups work.
If the delivery address has no postal value, Zip code matches neither is one of nor is not one of. Do not use is not one of as a test for whether a postal value exists. Add Zip code is not empty when the rule must require one.
Choose what happens to shipping methods
After adding the destination conditions, choose one of these recipes under Actions.
Hide methods in the matching region
- Select Hide specific delivery method(s).
- In Delivery method titles, enter a title or handle match and press Enter. Repeat for each method to hide.
- Set Status to Live, then select Save.
- Wait for Shopify sync to show Synced.
For example, use Shipping country is one of United States, Province code is one of CA, and Zip code is one of 902* to hide a selected method only for matching California postal codes.
Show only selected methods in the matching region
- Select Show only specific delivery method(s).
- In Delivery method titles, enter each method that should remain visible, pressing Enter after each value.
- Set Status to Live, then select Save.
- Wait for Shopify sync to show Synced.
This action hides eligible methods that do not match the entered titles or handles. If none match, it can leave the delivery group without a shipping choice. It cannot add a method that Shopify did not provide.
Test every delivery group
Shopify can split one checkout into multiple delivery groups. Address input evaluates each group against that group's destination, and the action changes only that group's delivery options.
Test all of these cases and inspect every delivery group each time:
- Use an address that matches the country, province code, and an exact postal entry. Confirm that only the intended methods change.
- Use an address that matches a postal wildcard, such as
90210for902*. Confirm the same expected action. - Use
X90210with902*. Confirm that the anchored pattern does not match and the action does not run. - Change the country, province code, or postal value so one required condition fails. Confirm that methods remain unchanged.
- Test before a postal value is available. Confirm that neither postal list operator makes the group match.
For a checkout with multiple delivery groups, a match in one group does not prove that another group matched. Confirm the visible methods separately in each group.
If results are unexpected, confirm the condition is available for the selected Function input, codes use the expected country and province, each list entry is on its own line, the rule is Live, and Shopify sync shows Synced.
