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

By Updated: August 17, 2019 11

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 Password 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!

WooCommerce Protected Categories

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!

WooCommerce Protected Categories

Start charging different prices for each zip code today!

Katie Keith

An active member of the global WordPress community, Barn2 Co-Founder Katie loves collaborating with other plugin companies. Her articles have been published on high profile sites including WPTavern, Torque and IndieHackers. She oversees all plugin support and deals with 'Tier 2' support requests about how to use Barn2's plugins in advanced ways.

11 Comments

  1. Fiona Walker
    May 20, 2019 Reply

    Hi, is there any way to make this NOT a password field? Instead of having it display **** but actually show the content of the field as the user types it and not have it an actual password field but just an input field?

    • EJ
      May 21, 2019 Reply

      Hi, Fiona. Since the password input field is for typing out a password after all, there is no built-in or default way to display this as plain text because that input field is designed to be a password, which will always be treated and displayed as such, rather than as plain text.

      I'm yet to find a plugin that can add this type of functionality to allow you to view or make visible the password input/text. What I found is a code snippet to show/hide the password field that you can ask your developer to use or build upon at https://codepen.io/Sohail05/pen/yOpeBm . If you don’t have one, we recommend posting a job on Codeable. We have partnered with them to provide plugin customizations for our customers.

      We haven't tested this with WooCommerce Password Protected Categories yet and you are most welcome to do so, which would be completely risk-free for you. We offer a full 30-day money back guarantee, which lets you buy the plugin and try it for up to a month, and get a full refund if you're unhappy with it or if it doesn't suit your needs.

  2. Paul Hickman
    March 21, 2019 Reply

    Also is it possible to change the "Incorrect password, please try again." text to something else? In our case "Sorry, we do not install in that area."

    • Katie Keith
      March 22, 2019 Reply

      Hi Paul, here's a link to the WooCommerce Protected Categories developer documentation which includes the filters you can use to change wording such as this.

Please share your thoughts...

Your email address will not be published.