How to set up WooCommerce zip code pricing based on postcode, country or area

February 1, 2021

WooCommerce Zipcode Based Pricing Plugin

A customer recently told me that there are no WooCommerce zip code based pricing plugins. I didn't believe this, so I had a look - and I couldn't find one either!

I'm writing this tutorial to show you how to set up WooCommerce zipcode based pricing using the WooCommerce Protected Categories plugin. You can use it to charge different prices depending on the customer's zip code, postcode, area, region or country. And it only takes a few minutes to set up!

The easy way to charge zipcode-specific prices for your WooCommerce products.

Why use a WooCommerce zip code based pricing plugin?

In an ideal world, everyone would pay the same amount regardless of where they live. However, there are situations where you might want to change your product pricing based on the customer's zip code or location.

Here are some reasons why you might need location-based pricing:

  • If you offer free shipping, then your profitability will vary depending on the customer's location. There's no way to avoid this because shipping companies often charge different rates depending on the customer's zip code, area or country. The easy solution is to set up WooCommerce shipping zones to charge zip code-based shipping, and keep your product prices consistent for all customers. However, if free shipping is a big selling point for your WooCommerce site, then you could keep this while charging higher product prices for customers in more remote locations.
  • If your website sells worldwide, then depending on your payment methods, taking payments from customers from other currencies might incur higher fees for you.
  • There may be higher legal or administrative fees relating to selling in certain places. You might try to recoup some of this by charging higher prices to those customers. For example, different locations may have different tax rules or legal requirements which make it harder to sell to that area.
  • If you provide local services then your prices may differ based on each customer's zip code area.
  • Perhaps you want to reward locals with lower pricing depending on their zip code.

If this sounds like you, then you may be able to increase profitability with WooCommerce zipcode based pricing or country-specific pricing. Read on to discover how to set this up.

What is WooCommerce Protected Categories?

WooCommerce Protected Categories is a WordPress plugin developed by us at Barn2 Media. It restricts access to certain products in your Woo store so that only people with the password can see and buy them.

I'll talk you through how to use the plugin to achieve zip code based pricing in WooCommerce. You can also use it to change product prices depending on postcode, region, location, country - whatever you like.

In a nutshell, the plugin lets you create a separate product category for each of your price bands. Each category is password protected using one or more zip codes or area names. The customer visits a central login page and enters their area or zip code as the password. This unlocks the category for their area, and instantly directs them to the products with the correct pricing.

Each password protected category will contain a different version of your products, with the correct pricing for that zip code area, region or country.

Each customer will only be able to see the pricing for their own zip code area (i.e. category).

How to set up WooCommerce zipcode based pricing

  1. First, get the plugin and install it on your website. Activate your license key (you'll receive this in the confirmation email).
  2. On the plugin settings page, choose the text that will appear above and on the category login form. For example, you will want to replace 'Enter your password' with 'Enter your zip code' or similar.
  3. Create a separate WooCommerce product category for each area that requires its own pricing. For example, you might sell products to 15 local zip codes based on 3 price bands. You would put the 5 zip codes for Band 1 in one category, the 5 zip codes for Band 2 in a second category, and so on.
  4. Password protect each category using the option in the 'Visibility' settings on the add/edit category page. Create a password using each area or zip code that you want to restrict the category to. For example, if you want customers in zip codes 123456 and 987654 to be able to access the category, then create 2 passwords: 123456 and 987654.
  5. Next, create a separate version of each product - one for each of the categories you just created. (Note: You can't put the same product in more than 1 password protected category. To get around this, the Duplicate Post plugin provides one-click cloning of WooCommerce products. If you're cloning products and want to manage inventory across the retail and wholesale versions of each product then we recommend the Group Stock Manager plugin. This lets you share stock levels across multiple products.)
  6. Put each product in the correct category.
  7. Change the pricing of each product as required.
  8. Create a category login page by adding the following shortcode wherever you want people to login to the category for their zipcode or area: [category_login].

When customers enter the password (i.e. their zipcode or area) into the category login form, they will automatically be directed to a hidden category containing the products with their local pricing.

But I want the public to be able to see my products!

The products with area-specific pricing will be hidden from the public parts of your website, so that only customers with the password can view them. However, you don't have to protect all your products in this way.

Perhaps you want to list each product on your public site, but also want a hidden version of each product for people from different zip code areas. You can achieve this by creating one or more public categories, which will not be password protected. These will appear in the public parts of your WC store in the usual way.

The pricing of your public products will NOT change depending on the customer's location. The same price will appear for everyone. This means that you need to either show a standard cost which will always be visible in the public part of your site.

If this isn't appropriate for your site, then you can list the public products without prices. WooCommerce will automatically disable the add to cart buttons for these products. People can view them but not buy online. Customers will have to request the password to view pricing and buy.

How can customers request the password for their zip code?

There are various options for how you can give each customer the password for their zip code. This will depend on how private you want your area-based pricing to be, and whether you have regular or one-off customers:

  • If your pricing is not confidential then you could list all the passwords publicly, above the category login form. Customers simply need to find the password relating to their zipcode area, and enter it to see their pricing.
  • You could use a WP contact form plugin such as Contact Form 7 to let customers request the password. This is a more secure option, as you can ensure that each customer can only access the prices for their own local zipcode.
  • If you have a members-only WooCommerce shop or WooCommerce wholesale store, then you might only sell to pre-approved customers. If this is the case, then you can give them the password directly.

What do you think?

Given that there aren't any dedicated WooCommerce Zip Code Based Pricing plugins, I'd love to hear how you get on with WooCommerce Protected Categories. I was really interested to hear that a customer was using it for this purpose, and thought that others might like to do the same.

Please leave your comments below!

Start charging different prices for each zip code today!


  1. Nikki
    July 26, 2021 Reply

    Hi, Fabio. Since you have different pricing for the same products on different zip codes, you will need to create individual categories for each zip code and then duplicate your products using a Duplicate Post plugin so you can assign unique pricing and discounts for products within each category. When customers enter the password (i.e. their zip code or area) into the category login form, they will automatically be directed to a hidden category containing the products with their local pricing. Should you have any questions, please let me know. You can also enquire in more detail via our dedicated Support Center. Many thanks!

  2. Lee
    December 14, 2020 Reply

    This seems like a good solution if the pricing is only limited to a handful of zip codes. However, if the product pricing needed to be different for hundreds of zip codes it would take forever to enter each code as a password?

    • Nikki
      December 14, 2020 Reply

      Hi, Lee. I'm glad you found our tutorial that shows you how you can use our plugin for zip code based pricing in WooCommerce. We have an Advanced Usage article that shows you how you can import or load category passwords in bulk Please see: Bulk importing passwords into WooCommerce Protected Categories. While there is no limit to the number of passwords that our plugin can handle, such a large number can be expected to cause the querying of each protected category to take longer than usual (i.e. page load time when viewing a protected category archive/page). Our plugin would need to go through and check the validity of a submitted password against the entire list of passwords of a protected category.

      Due to how WordPress works, this increase in page load time can be influenced (increased or decreased) by factors such as the webserver that your site is on and the PHP settings/restrictions/limits of your site (such as memory limit, max execution time, etc.). I hope this answers your question and helps. You can also open a support request through our Support Center if you have other questions. Thanks!

  3. Steven
    December 6, 2020 Reply

    Hi, how granular does the postcode need to be in order for this to work? For instance if I want to restrict pricing

    • Jae Narra
      December 7, 2020 Reply

      Hi Steven,

      Thanks for your interest in our WooCommerce Protected Categories plugin and for your comment.

      Please, could you provide more information about your concern and send it through our Support Center so we can properly advise you?

      We look forward to your email.

Please share your thoughts...

Your email address will not be published.