NEWDiscoverShipGoal– turn cart progress into bigger baskets
All articles

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.

Which conditions can be combined

You do not choose a Function input when you create the rule. Add your conditions, and ShipWith picks a Function input that supports all of them. If a condition you need is greyed out under Can't be combined with your existing conditions, no single input supports it together with the conditions already on the rule.

The destination conditions in this article work with these inputs:

  • Standard input, Customer input, and Address input support Shipping country, Province code, and Zip code.
  • Attribute input supports Zip code, but not Shipping country or Province code.
  • Shipping input does not support these destination conditions.

Country, province code, and postal code conditions can always be combined with each other. Adding detailed destination fields, such as Phone number, moves the rule to Address input, whose description in ShipWith is Destination address fields for each delivery group. A condition that only Shipping input supports, such as Shipping method, cannot be combined with them.

The current UI label is Zip code. It checks either a ZIP code or another postal-code format. To see which input the rule uses, open the Advanced card on the rule page.

Read Choose the right Function input type for your rule for more about each input.

Set destination conditions

  1. Create a shipping rule.
  2. Under When the rule runs, select When set conditions are met.
  3. Add Shipping country, then choose is one of or is not one of and select the countries.
  4. 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 CA and OR.
  5. 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* matches 902, 90210, and 902ABC.
  • *210 matches values ending in 210.
  • 90*10 matches values that start with 90 and end with 10.
  • * 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.

Use postal-code number ranges

For Zip code with is one of or is not one of, 2000-2050 matches every number from 2000 to 2050, both ends included. Both ends must be numbers with the same number of digits, and the first must be the smaller one. Leading zeros count: 0800-0899 matches 0850, but not 850.

The postal value must also be a number with that many digits. 2000-2050 does not match 20000.

Codes that already contain a hyphen stay exact matches. 100-0001 (Japan), 00-950 (Poland), and 90210-1234 (ZIP+4) are not ranges, because their two sides have different lengths.

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

  1. Select Hide specific delivery method(s).
  2. In Delivery method titles, enter a title or handle match and press Enter. Repeat for each method to hide.
  3. Set Status to Live, then select Save.
  4. Check that the rule page shows no This rule is not running at checkout banner.

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

  1. Select Show only specific delivery method(s).
  2. In Delivery method titles, enter each method that should remain visible, pressing Enter after each value.
  3. Set Status to Live, then select Save.
  4. Check that the rule page shows no This rule is not running at checkout banner.

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. ShipWith 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:

  1. Use an address that matches the country, province code, and an exact postal entry. Confirm that only the intended methods change.
  2. Use an address that matches a postal wildcard, such as 90210 for 902*. Confirm the same expected action.
  3. Use X90210 with 902*. Confirm that the anchored pattern does not match and the action does not run.
  4. Change the country, province code, or postal value so one required condition fails. Confirm that methods remain unchanged.
  5. 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 rule's conditions are the ones you expect, codes use the expected country and province, each list entry is on its own line, the rule is Live, and the rule page shows no This rule is not running at checkout banner. Long lists can push a rule over Shopify's size limit. Save them once in Settings > Postcode lists and use is in list instead of pasting them into every rule.