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!

20 Comments

  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.

  4. Umer
    May 8, 2020 Reply

    If there any plugin available in WordPress.
    When someone enter zip code and get service price based on zip code?
    please advise

    • EJ
      May 14, 2020 Reply

      Hi, Umer. You've come to the right place as our article describes exactly what you're asking about or looking for! Should you have any questions, let us know via our Support Center. Thanks!

  5. Sam Baker
    January 23, 2020 Reply

    I have a brick and mortar store and am starting an eCommerce store. I want to offer a different price for my local customers than remote customers. Do you have a plugin which can geo-locate a user and offer them pricing accordingly. For example, if a customer is within 100 miles of my store (I could also specify ZIP codes), I want to offer them a higher price than a customer who is far away and wants to buy my product over the internet.

    • EJ
      March 4, 2020 Reply

      Hi, Sam. Thanks for your comment and my apologies for the late reply. You can get in touch with us quicker via our dedicated Support Center.

      What you describe involves using a WooCommerce geolocation-based products plugin to determine which products to display to the user, without the need to enter a zip code as a password.

      As explained in this tutorial, you can use our WooCommerce Protected Categories plugin to determine which protected product category to display and bring the user to, based on the password that they enter (which you can use the 100-mile radius zip codes for). If a user enters a valid zip code, this would be the password that then takes them to the product category that shows them products priced according to that zip code. An unrecognized zip code would not be accepted as a password and so those users would need to browse and purchase from the public, non-protected/private categories on your site.

  6. 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.

  7. 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.

  8. Paul Hickman
    March 21, 2019 Reply

    I have set this up and it looks like it is going to achieve what we were after (Post Code based installation costs).
    However, I do not need to redirect customers to a new page after logging in, I really need to stay on the same page.
    Is that possible?

    Many thanks,
    Paul

    • Katie Keith
      March 22, 2019 Reply

      It depends on where people are entering the password. If you give them a link to the actual category page or a specific product page, then they will see the password entry form when they first visit it. When they enter the password, they will remain on that page but will be able to see the full content (i.e. the products).

      If you add the login form to a different page then it's not possible to keep people on the same page. This is because the plugin is designed to redirect people to the unlocked category page that matches the password they have entered.

  9. YA
    February 11, 2019 Reply

    Hi, how granular does the postcode need to be in order for this to work? For instance if I want to restrict pricing to one side of London could I just use the first part of the postcode to distinguish between the two halves of London or would we need to enter individual street level / full postcodes?

    • Katie Keith
      February 12, 2019 Reply

      You need to enter the passwords in the exact format that people will be entering them. So if you just want to add the first part of the postcode then that's fine, and you should add a message above the postcode/password entry form telling people to do this. Or if you want more granular control then you can enter the full postcodes as passwords, and instruct people to enter their full postcode. All that matters is that the passwords match what your customers enter.

  10. Jim
    October 17, 2018 Reply

    Can you set the password as the postcodes the category corresponds to? It would eliminate the need to give them the password :)

    • Katie Keith
      October 17, 2018 Reply

      Yes, that's a good idea. Create a password matching each of the postcodes that the category corresponds to (without spaces), and customers can login with the postcode.

  11. Lalit Mittal
    July 10, 2018 Reply

    It really Grt Info. I was looking for the plugin that can help me to set up the different price of delivery for different ZIP codes for my e-com website.

Please share your thoughts...

Your email address will not be published.