WooCommerce Shipping Based on Zip Code/Postcode/Postal Code

WooCommerce Shipping Based on Zip Code
Author Bartosz Gajewski
Reading time:
4 minutes read

When running an online store, you may want to set the cost of delivery of products based on the delivery address. Such a procedure allows the buyer to offer the optimal shipping cost, which builds loyalty. This can contribute to generating more traffic in the store and improving conversion. This article will show you how to set WooCommerce shipping based on zip code/postcode/postal code.

Let’s start with a bit of theory. You can’t talk about WooCommerce shipping based on zip code without mentioning WooCommerce shipping zones…

WooCommerce Shipping Zones in a nutshell

To cut the story short the shipping zones are groups of locations where you want to ship your products to. You can easily group the continents, countries, states/provinces and even Zip or postal codes. WooCommerce will match a customer to a single zone using their shipping address and present the shipping methods within that zone to them. In other words, you can use them to:

  • offer the same shipping method or set of methods for the whole Europe,
  • define a shipping zone covering a few selected USA states e.g. FL, GA and AL,
  • narrow down the shipping area precisely to include only specific city district based on postcodes.

However, these are only a few examples of shipping zones’ usage. It’s all up to you how you configure them and which setup suits your business best.

If you want to learn more about shipping zones in WooCommerce, be sure to check out our article WooCommerce Shipping Zones Explained.

How to add Shipping Zones based on Zip/Postcodes?

You may have noticed in the previous paragraph the statement that you can group shipping based on Zip Code. That’s exactly what we are going to do now.

Create Shipping Zone in WooCommerce

The first step to setting up WooCommerce shipping based on postcode is to create a shipping zone. You may already have them in your WooCommerce store, but this shipping guide will show how to create them from scratch. For adding shipping zones, go to WooCommece -> Settings -> Shipping -> Shipping Zones. Then click the Add Shipping Zone button.

Create shipping zone in WooCommerce

Configure Shipping Zone

You will be redirected to the new shipping zone settings page.

configure shipping zone in WooCommerce


Define its name by filling in the Zone name field and select below the Zone regions which it should cover. As I mentioned before you can set the shipping zone to cover the entire continent, country, region or even postcodes. To set Shipping Zone based on Zip/Postcodes, use the Limit to specific ZIP/postcodes link.

limit to specific postcodes in WooCommerce

Once the Limit to specific ZIP/postcodes link is clicked the additional text-area field will appear below where you can put all the postcodes you want the shipping zone to be narrowed to. What’s most important here is that you can enter them in three different ways:

  1. directly, typing the full postcodes manually one per line, e.g.:
    Postcodes list
  2. by defining their ranges, e.g. 90210…99000. If used, the shipping zone will cover all the postcodes between 90210 and 99000 such as 90211, 93123, 98157, etc.
  3. using so called wildcards and placing an asterisk sign * in right place of the postcode, e.g. AB10* wildcard will cover all the postcodes starting with ‘AB10’ phrase, e.g. AB10 1AP, AB10 1AR, AB10 1AQ and so on.

UK Shipping zones configuration - Postcodes pasting

Add shipping method based on postcode

When you have your shipping zone based on postal codes configured, you can add a shipping method that will be displayed for your customers using their shipping address. To do that, just click on Add shipping method button and select the type of your shipping method.

WooCommerce Add shipping method window
Add shipping method

In the popup window, which should appear, choose Flat rate, Free shipping, Local pickup or Flexible Shipping method if you have the Flexible Shipping plugin installed. Then, configure it according to your needs. You can add as many shipping methods within a shipping zone as you want.

Remember to Save changes and your shipping zone based on postcodes is ready to use. Probably you’ll set another one for other postcodes. And another one for each location. What if I told you that it could be done better?

Better way to set WooCommerce shipping based on Zip Code/Postcode/Postal Code

Instead of creating a separate shipping zone for each zip code, you can set up the same thing in one shipping zone. How? The answer, as usual with WordPress, is the right plugin.

This time, I’m going to use the Flexible Shipping Locations plugin, which is basically an add-on to the free version of the Flexible Shipping plugin. It allows you to set the shipping cost for specific locations. You can create custom locations based on zip code, so it will be much easier to configure.

Flexible Shipping Locations WooCommerce 29.00

Extend Flexible Shipping with custom locations and create shipping costs based on weight, order totals or item count.

Add to cart or View Details
Plugins used by 243,566+ shops
Last Updated: 2024-07-01
Works with WooCommerce 8.7 - 9.1.x

I’ll show you step-by-step how to set WooCommerce shipping based on zip code/postcode.

Configure custom shipping locations in WooCommerce

First, please make sure you have installed and activated the Flexible Shipping and Flexible Shipping Locations plugins. Then, go to WooCommerce → Settings → Shipping → Flexible Shipping Locations.

flexible shipping locations menu

You can create unlimited custom locations by clicking Add location button.

set custom shipping locations

As you can see, it’s very similar to the shipping zones configuration. But in that case, it’s much faster and easier to configure. To create a custom location, enter Location Name, Region and postcodes. Once the Limit to specific ZIP/postcodes link is clicked the additional text-area field will appear below where you can put all the postcodes you want. It works exactly like in the shipping zones, so you can use full postcodes, ranges or wildcards. Add as many locations as you need and Save changes. Remember to name them in an easy-to-understand way so that you can recognize them later.

If you need further information, check Flexible Shipping Locations documentation.

Set shipping method based on zip code

Now, it’s time to add a shipping method. Go to the shipping zone that will match with all the custom locations you have just created and click on Add shipping method button. In the popup window, choose Flexible Shipping method if you have the Flexible Shipping plugin installed. The new Flexible Shipping method will be available to edit. Click on it to set the WooCommerce shipping based on postcode.

new flexible shipping method

You can set that method title and description, change its tax setting and all the additional features that are included in the Flexible Shipping plugin. After you set that up, scroll down to the Shipping Cost Calculation Rules table.

Shipping Cost Calculation Rules table

In the conditions field, select Location.

shipping based on location in WooCommerce

Then, select your custom location and set it’s cost. You should add a new rule for each of your custom locations.

shipping cost based on postcodes in WooCommerce

This way, that shipping method will be displayed only when one of your custom locations will match the customer’s address. As you can see, you can also set different shipping cost based on location. As usual, remember to Save changes, and you are good to go.

WooCommerce Shipping Based on Zip Code/Postcode/Postal Code

In this article, I showed you how to set WooCommerce shipping based on postcode using shipping zones and Flexible Shipping Locations plugin. I hope it will be helpful for you and your business. Good luck!

Notify of
Inline Feedbacks
View all comments
2 years ago

Thank you for the nice explanation about the use of wildcards.

7 months ago

Hello, I did as you asked using wildcards, but the problem is the payment method is still shown even if we dont deliver in that area, if the delivery is off then there should be no delivery option

Łukasz Spryszak
Łukasz Spryszak
Reply to  Sakina
7 months ago

Hi Sakina, just to make sure if I got everything right – the payment method is being displayed in your shop’s checkout even when there are no shipping methods available to pick – is that correct?

Check out our case studies

Dream Home Story
Furniture shipping via WooCommerce – Dream Home’s Case Study

Learn how to configure custom shipping rules for furniture orders – from heavy and bulky to small and light.

4 minutes read
Octolize Case Study
Vitrek’s Story

Read Octolize Case Study about Vitrek – a provider of innovative global solutions for High Voltage Test and Measurement.

2 minutes read
Octolize Case Study
EnglishSpeakingMum’s Story

Read Octolize Case Study about EnglishSpeakingMum – Polish dedicated and involved parenting blogger.

2 minutes read