Shipping Table Rates for different postal code systems [Expert tips]

Table of Content

Custom shipping methods.
Posted in: Magento 2 Guides

During the period of pandemic and quarantine, fast delivery from online stores has become even more important for e-commerce. Businesses met multiple difficulties like:

  • sharply increased demand for delivery of goods;
  • shortage of couriers;
  • the need to ensure the safety of employees and clients;
  • problems with the delivery of goods due to closed borders, etc.

The increased interest in shipping modules has also increased the number of support requests. Thus, today we are going to talk about our most popular shipping extensions - Magento 2 Shipping Table Rates. Our customers from the USA, the UK, Canada, and the Netherlands often ask about ways to configure this extension to fit their business needs.

The trick is the module is extremely easy to configure for countries with numeric postcodes. Yet, when postcodes contain letters, as in the Netherlands or in the USA, store owners need to understand the nitty-gritty of Shipping Table Rates.

In this article, we will show how to configure Shipping Table Rates for high performance and the processing of non-numeric postal codes. Also, we'll explore how to enable in-store pickup.


The basics of Shipping Table Rates

Let’s start with a quick overview of the module. Magento default functionality includes integration with worldwide popular shipping carriers (such as UPS, USPS, FedEx) and provides some shipping methods out of the box (for example, Free Shipping and Flat Rate).

However, sometimes store owners need custom shipping methods. The Shipping Table Rates module is the solution designed to help you with this. The extension adds one more shipping carrier to your Magento store. By default, it’s called “Shipping Table Rates” but you can rename it the way you want.

Using the extension, you can create custom shipping methods (say, depending on a product’s weight and quantity or a customer’s location) and associate them with this carrier:

Though the number of methods is not limited, we recommend working with maximum 10 to 15 methods in order to prevent stack overflow. To maintain the store high performance, use the extension functionality to the full, and create group methods with several rates. Rates are calculated according to a predefined scheme and apply under certain conditions, for example, when an item weight or quantity falls into a certain range:


When a customer places an order, the extension checks applicable shipping rates and offers them to choose a preferred option at the checkout page.

A few words about postal codes

One more option to decrease the number of shipping methods, and hence improve your store performance, is to create methods related to geographical areas. To specify the area where a rate is applicable, just use Magento country codes or a postal code range as shown in the screenshot:

postal codes

Shipping Table Rates has two modes of processing postal codes. When you set postcode ranges, you can configure the extension to treat them either as strings or as numbers:

If you’re located in a country that uses numeric postal codes, like the USA, it’s better to choose Compare postcodes as numbers. If postal codes include letters as well, you should use the Compare as strings mode. This option is based on the SQL LIKE function and allows you to use the percent sign in a postal code wording.

The percent sign shows that a particular part of a postal code can vary. For example, the expression “123%123” covers such postal codes as  “1234123”, “123AM4123”, and “123VOYAGE123”. If you put the percent sign at the beginning or at the end of your expression (for example, “123%” or “%123”), you specify that a postal code can start or end with any number or letter.

A complete description of this function you can find at W3 Schools.

Choosing a mode of processing postal codes is a general setting of Shipping Table Rates, so it is applied to all methods at once. With this in mind, consider all the areas you need to cover and only then pick a preferable processing mode. Though Compare postcodes as strings is a bit less convenient for dealing with numeric postal codes, it is universal and can be used for numeric and alphanumeric codes alike.

Now, let’s move on directly to configuring Shipping Table Rates in particular cases.

Configuring Shipping Table Rates for in-store pickup

Let’s imagine Julie, an ambitious and creative maker of handmade accessories. For now, her products are available only for in-store pickup in Newark. There are two ways she can set such a shipping method in her Magento store: using off-the-shelf Free Shipping and Flat Rate or Amasty Shipping Table Rates.

#1. Magento Free Shipping or Flat Rate for in-store pickup

If Julie has a single store, this option is the most suitable one as it requires no extensions. Julie can just rename Magento built-in shipping carriers and methods to emulate the in-store pickup functionality. This is how the settings will look like using Free Shipping:

And this is a configured Flat Rate:

#2. Amasty Shipping Table Rates for in-store pickup

If Julie has a number of pickup points, Shipping Table Rates will make the configuration of shipping methods more convenient than Magento out-of-the-box functionality.

Suppose Julie tracks a customer’s location and uses this data to offer relevant pickup points. In this case, she can put all pickup points in the same method using the {day} variable. As the {day} variable can be a text, Julie can use it to specify addresses of her stores. How to do it?

First, let’s create a shipping method as shown in the screenshot:

in-store pickup

Now go to Methods and Rates and add a rate per each pickup point. In the Rate Configuration window, use the Estimated delivery (days) field to specify a shipping address as below:

rate settings for in-store pickup

For every pickup point, specify appropriate postal code ranges. In our example, we get two addresses available for in-store pickup:

Now a customer will see the pickup point relevant to their address.

If you want all pickup points to be available regardless of a customer’s address, add each point as a separate method:

This is what a customer will see as a result:

→ Show the nearest offline store on the map with the Store Locator plugin

Configuring Shipping Table Rates for the USA

The business is growing and “Julie’s accessories LLC” is well known across the United States. She reasonably decides to organize her own delivery service.

If Julie wants to serve customers just from New Jersey, she can choose a relevant option in State/Province. However, if Julie needs to specify rates with higher accuracy, linking rates to ZIP codes is a very useful option.

Remember how to use postal codes in Shipping Table Rates? ZIP codes in the USA are numeric, so we will use Compare postcodes as numbers. To cover an area in Newark, we will specify a range from 07101 to 07108 in the ZipFrom and ZipTo fields.

Comparing postal codes as strings can be useful sometimes as well. For example, this way you can use 07% to easily cover an entire area with postcodes starting with 07.

Configuring Shipping Table Rates for the Netherlands

Say, Julie decides to try her luck abroad and sell handmade accessories in Europe, the Netherlands. Most postcodes in the Netherlands are alphanumeric. For example, they look like 1000 AP. Sometimes postcodes contain only digits.

In general, if you deal with alphanumeric postal codes, processing codes as strings is preferable. Yet, as in the case with the Netherlands, postcodes include a blank space between the parts with numbers and letters. In this case, you can use Compare postcodes as numbers and include only relevant digits in ranges:

This is what a customer will see as a result:

Configuring Shipping Table Rates for the UK

Expanding business further in Europe, Julie aims at the UK market. The UK Royal Mail also deals with an alphanumeric postcode system. To make things worse, postal codes have different length. Each postcode is divided into two parts, the outward code and the inward code, separated with the space symbol.

Julie can Compare postcodes as numbers in the following way:

Sometimes Comparing postcodes as strings is a more suitable option. For example, to cover an entire Lincoln postcode area, Julie can use the “LN%” expression in the Zip From field. This is what her customers will see:

One more popular question is how to create specific rates for different parts of the UK. For example, what if Julie offers delivery in mainland Britain (England, Wales, and Scotland) and in other UK territories at different delivery rates.

At first, it seems that she should specify a rate per every single area but that’s hardly reasonable as all rates will be the same with few exceptions. She can also set a general rule and add some exceptions. Yet, Shipping Table Rates offers a more elegant and easy solution.

The extension has a nifty feature: when two rates relate to one method, the tiniest one applies. For example, Julie’s method includes rates for the Belfast postcode area and UK mainland as follows:

Suppose a customer’s postal code is BT1 2DF. It matches both rates with the BT% and ALL configurations. As the BT% group is a subset of All and it fits the customer’s address better, only the rate related to BT% will apply. Customers coming from outside Belfast will see rates as for UK mainland. This is how it looks like in Magento:

For customers from non-mainland UK, Belfast:

For customers from UK mainland:

Configuring Shipping Table Rates for Canada

You’ve guessed it, Julie is going to sell her products in Canada. Postal codes in Canada are combinations of letters and numbers. They usually look like K1A 2C3 with the first three symbols are related to a forward sortation area (FSA) and the last three symbols - to a local delivery unit.

Comparing postcodes as strings will work here well.

Suppose Julie wants to apply the extension to the area that comprises all postcodes from R0C to R9N, including R0C, R1C, R2C, etc. as well as R8N, R9N and so on. If she sets configurations as below, the rate will affect only the postcodes like "R{number}C" and “R{number}N":

canada postal codes

This means postcodes like "R{number}B" or "R{number}D" will be left out. To cover every area, Julie needs to set a separate rate for every type of postcode (for example, R{number}C or R{number}N). She can just put R%C% in the From field leaving the To field empty and this rate will suit all R{number}C postcodes.

To reduce the number of methods that you need to cover all postcode types, use one method for two types simultaneously. Just fill the From field with one postcode type and the To field with another and both will apply as they should do.

So you can replace any symbol with the percent sign to cover a group of postcodes. See below for some examples:

  • If you need a range like "R0A, R0B, R0C, ..., R0Z", you should use "R0%".
  • If you need a range like "R0A, R1A, R2A, R3A, …, R9A", you should use "R%A%".
  • If you need a range like "A1B, B1B, C1B, …, Z1B", you should use "%1B%".

Please, mind that one percent sign is enough. There’s no need to use “R0%%%%” in order to emphasize that last four symbols can vary.

→ Check the solution of the most common issues with the Shipping Table Rates extension


As you can see, the Magento 2 Shipping Table Rates extension allows you to deal with any national postcode system. I hope this article explained how to use the module to offer in-store pickup and configure rates for the USA, the UK, the Netherlands, and Canada.

If you still have questions, drop us a line in the comments below. We’ll do our best to answer them.

Stay tuned!

May 16, 2018
May 23, 2018
May 11, 2018
September 10, 2018
In Australia most postal zones have non-sequential postcodes. For example, a postal zone might be 4309-4453 and 4580-4693, although they can be far more complex than this. Is there a way in the M2 Enterprise shipping table extension to handle complex ranges of post codes to define the geographical area of the zone?
Alina Bragina
November 2, 2018
Hey Scott, thanks for reading and commenting! As for today, we have no functionality for working with the case you've described. However, we do have it in future plans. Our support team managers will be happy if you found time to talk to them about this and show the use cases, which are popular in Australia. Please, contact our support team via [email protected] if it's still relevant. Cheers!
September 9, 2020
Hello, Has there been added support for such zip codes listed above, i.e 15234-2019 ? I.E with a hyphen. I ask because when creating zones with 5 digits only, while the rates load fine, it conflicts with Avalara Address Validation which will not recognize a shipping method until the US zip code is 9 digits i.e 12534-2019. Problem is when I create separate 'rates' for zones using this logic, in addition to the default '5 digit' rates, I find conflicts in the shopping cart where 2 different zones load. Curious if updates to this module address this or if I need to add some logic in "Shipping Rules' to try to remove instances of 90210 loading BOTH east coast and west coast rates. Thank you.
Alina Bragina
September 16, 2020
Hi, Joel. If you've already bought our Shipping Table Rates, please <a href="">leave us a ticket</a> and our managers will get back to you within 48 hours. In case you're just considering if to buy this module, please feel free to contact our support managers via live chat. In turn, I've contacted our customer service manager and found out that this is a very rare case that requires a unique approach. So, contact our support managers, they'll be happy to help you out.
May 11, 2019
We are located in the US and ship packages all over the world. We ship UPS Ground,3 Day Select,2nd Day Air, and Next Day Air to the contiguous United States. We ship 2nd Day Air & Next Day Air to Alaska, Hawaii, and Puerto Rico. We use USPS International Mail for remaining US Territories, US Military, and all foreign countries. Is there a way to set up the International rate without including every non-US country?
Alexander Kosarau
May 17, 2019
Hello Rick, Thank you for reading my article! Yes, there is a way to achieve what you need. As you might know, there is tiniest match rule. To learn more, please <a href="" rel="nofollow">visit the guide.</a> You can specify a general rate (not country-specific, country is ALL) and specify US rate. If you have further questions, please drop us a line at [email protected]. You can mark my name in the email - and I will respond to you :)
May 15, 2019
Thanks for the helpful blog post. Is there a way to allow a shipping method to all postcodes except specific ones (e.g. Next day service to all of the UK except BT postcodes where there is no shipping option) Thanks.
Alexander Kosarau
May 17, 2019
Hello Morgan! I am so happy to see my blog post was helpful :) My clients from the United Kingdom often ask mainland-and-islands issues. There are two options I advise to consider: 1. Specify general, country-wide rate and local rates. This can be achieved by our tiniest match rule: see <a href="" rel="nofollow">tiniest match rule</a> and <a href="" rel="nofollow">shipping table rates for the UK</a>. 2. You can restrict delivery methods for particular areas by using <a href="" rel="nofollow">Shipping Restrictions</a>. To get more related examples, please explore this <a href="" rel="nofollow">blog post</a>. If you have further questions, please drop us a line at [email protected]. You can mark my name in the email – and I will respond to you ?
October 29, 2019
March 14, 2024
Question about Netherlands. As you said our postcode is 4 digits and 2 letters, but people now a days don't always put the blank space between the numbers and the letters. Can I still use "Compare postcodes as numbers" if no blank space will be used? Or do I need to Compare as string now?
March 20, 2024
Hi, Joanne. You can use the "Compare postcodes as numbers" option even if there's no space between the numbers and letters! Magento is set up to understand postcodes correctly, regardless of the spacing. So, you don't need to worry about it when setting up your shipping rates.
Leave your comment

Your email address will not be published

This blog was created with Amasty Blog Pro

This blog was created with Amasty Blog Pro