Commerce Layer will be proud to sponsor the next JAMstack Conf in London — 09-10 July, 2019 🎉 Stay tuned!

GLOSSARY

Shipping zone

A specific geographical area to which you want to ship your items


Generally speaking, any geographical area that you ship is a shipping zone. Each shipping zone includes shipping rates that apply to customers whose addresses are within that zone. It can be based on a single country, a group of countries, states/provinces, or zip/post codes.

Within Commerce Layer, you can define many shipping zones that offer different services. You can associate them with different shipping methods, and get as specific as you need. From a country level right down to regions, states and zip codes. You can group, include or exclude some of them.

In detail, the shipping zones you create, contribute to defining the Shipping Methods available in your Market.

A Commerce Layer’s shipping zone is defined by:

  • a name (the internal identifier for this resource within your organization)
  • some regular expressions, that select the geographical area(s) associated with this shipping zone.

Filling one (or more) regex field is optional. If you want, you can leave them empty and create a global shipping zone. It will represent a worldwide shipping method without any limitation. Otherwise, there are three main levels of detail these regular expressions can be applied to country codes, state codes and Zip codes:

  • Country code regex - the country codes that should be included in this zone
  • Not country code regex - the country codes that should be excluded from this zone
  • State code regex - the state codes that should be included in this zone
  • Not state code regex - the state codes that should be excluded from this zone
  • Zip code regex - the zip codes that should be included in this zone
  • Not zip code regex - the zip codes that should be excluded from this zone

A regular expression (regex or regexp) is a sequence of characters that define a search pattern. To be simple, it is an expression used to specify a set of strings required for a particular purpose. Using regular expressions when defining shipping zones gives you a lot of freedom. You can add, combine or exclude the codes you need. From a simple sequence to any complex logic composition of them (or part of them).

If you need to go further into regex this is a nice online tool to learn, build and test regular expressions.

Examples

As mentioned above, a shipping zone is the answer to the need to ship to specific areas that have particular shipping methods. Most of the times, it is a matter of shipping rates or Delivery Lead Times. Shipping items to certain places can be more (or less) expensive or could take more (or less) time. And this may be due to accessibility, logistical or fiscal reasons.

Proximity Criteria

Let’s assume you’re shipping from a single physical warehouse to your whole country with a standard 3-day shipping. If you can guarantee a faster shipping to a limited area around your warehouse, you should create the related shipping zone.

Jersey Island

Jersey is the largest of the Channel Islands, between England and France. A self-governing dependency of the United Kingdom. Shipping to the Channel Islands is far more expensive than shipping to the rest of the UK. This is the reason why you need to create a specific shipping zone if you’re shipping to the UK and you want to reach Jersey too.

Some common regex

Here below you can find a few practical examples of how to use regular expressions to define shipping zones.

  • Jersey Island
    Referring to the above-mentioned case, if you want to create a shipping zone associated with the Jersey island, you should:

    • set GB as the country code
    • put (?i)(JE1|JE2|JE3|JE4|JE5) in the zip code regex field.
  • US states and postal codes
    If you want to create a shipping zone associated with all the US states, you have to:

    • set US as the country code
    • put (?:A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST] |N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY]) in the state code regex field.

      If you want to do the same with all the US zip codes (with an optional 4 number zip code extension) you have to:

    • set again US as the country code
    • put ([0-9]{5}(?:-[0-9]{4})?) in the zip code regex field.
  • Canadian provinces
    If you want to create a shipping zone associated with all the provinces of Canada, you have to:

    • set CA as the country code
    • put (?:AB|BC|MB|N[BLTSU]|ON|PE|QC|SK|YT) in the state code regex field.