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.
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.
Configure Shipping Zone
You will be redirected to the new shipping zone settings page.
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.
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:
- directly, typing the full postcodes manually one per line, e.g.:
- 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.
- 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.
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 onbutton and select the type of your 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.
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.
You can create unlimited custom locations by clicking Add location button.
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.
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 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.button. In the popup window, choose Flexible Shipping method if you have the
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.
In the conditions field, select Location.
Then, select your custom location and set it's cost. You should add a new rule for each of your custom locations.
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!