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…
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:
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.
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.
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.
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:
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.
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?
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.
Extend Flexible Shipping with custom locations and create shipping costs based on weight, order totals or item count.
View Details or Add to cartI’ll show you step-by-step how to set WooCommerce shipping based on zip code/postcode.
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.
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.
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.
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!
Thank you for the nice explanation about the use of wildcards.
Thank you!
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
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?