How to Hide WooCommerce Products Based on Visitor Location

As an online store owner, you’re always trying to grow your business. One way to do this is by expanding your customer base internationally. However, you need to be careful about selling the “right” products to customers based on the country they live in.

This means that you need to keep in mind international laws when selling to international customers and hide specific products from your shop based on the customer’s geographical location. Since WooCommerce by default doesn’t have built-in functionality that lets you do this, we recommend using a robust plugin such as Distancr.

This makes it easy for online merchants to hide WooCommerce products based on the visitor’s location. With this in mind, in this tutorial, we’ll show you how you can hide WooCommerce products based on the customer’s location using Distancr.

Why hide WooCommerce products based on visitor location?

Depending on your online store and the products you sell, it might be useful to hide some WooCommerce products from specific users based on their geographical location. This offers an easy way to hide unsuitable or illegal products for specific customers based on their region.

For instance, you might need to hide WooCommerce products such as caviar, Cuban cigars, Kinder Surprise, alcoholic energy drinks, or lawn darts as they might be prohibited in specific regions or countries.

Hiding WooCommerce products based on the visitors’ location can also be great for offering exclusive country deals or area deals on your online store.

Similarly, it’s also easier to offer local products to your local customer base only. This way, you can offer much more convenient shipping methods such as local pickup, or local payment gateways for your local customer base. This way, you not only offer an enhanced user experience but also encourage more of your local customer base to shop from your online store.

There are many types of WooCommerce stores that might find it useful to hide products based on their visitor’s location. Let’s step through a few examples:

  • Stores that sell products locally only. Stores that offer a wide range of local products only to their local customer base might find it useful to hide products based on the visitor’s location. For instance, stores that sell food items such as dairy products or fresh meat cannot ship to a further off location as the product would go bad or expire by the time it reaches the customer. Instead, you can sell all products in the “Dairy” and “Fresh Meat” categories on your online store to local customers only.
  • Stores that sell only certain products outside their locality. Some online stores that sell products out of their locality might find it useful to hide those products from local customers. For instance, a store that sells bakery goods might choose to sell specific items such as bread and biscuits outside of their locality only. On the other hand, other products such as pastries, croissants, and cakes, are for local customers only.
  • Stores that sell different product variants in different countries. It can also be useful for stores that sell different product variations in different countries to hide specific product variations from their shop page. For example, a store that sells outdoor furniture sells products that are more suitable for sunny weather only to customers that live in a region where they receive more sun. Similarly, waterproof outdoor furniture might only be meant for customers in areas that are known to receive heavy rainfall year-round.

This helps cater to all types of customers while improving the shopping experience on your online store. Customers will only see products that are more “relevant” to them, rather than being shown products that they cannot order.

Introducing Distancr

Distancr is a robust geolocation plugin for WordPress that lets you showcase products based on the customer’s physical location.

Some notable features of the plugin include:

  • You can add multiple locations to your WooCommerce store using the Distancr plugin. This makes it easy for store managers to cater to all types of customers from all across the globe.
  • Lets you modify product prices on your WooCommerce store globally, per product, per product variation, or per-category basis. In addition to this, you can also set prices based on the geolocation of your customers. This lets you cover additional expenses when sending out an order that’s halfway across the globe.
  • The standout feature of the plugin is hiding WooCommerce products based on the geographical location of your customers. Distancr gives you full control over product visibility options for your WooCommerce store. This helps you offer a unique and enhanced shopping experience.
  • The Distancr plugin also lets you set up blocklists on your WooCommerce store. This way, you can restrict user access to specific categories, shipping methods, and payment gateways based on the geographical location of the user.

How to hide WooCommerce products based on visitor location using Distancr

Here, we’ll show you how to hide WooCommerce products based on visitor location using the Distancr plugin. To do this, here’s what you’ll need:

  • A WordPress site with the WooCommerce plugin installed and set up.
  • Some WooCommerce products.
  • The Distancr plugin.

Step #1: Install and set up the Distancr plugin on your WooCommerce site

Get the Distancr plugin and install it on your WooCommerce site. Navigate to WooCommerce > Settings > Distancr to set up the plugin on your online store.

Distancr options

Click on the Options link to start configuring geolocation settings for your WooCommerce site. Using the Distance Unit dropdown menu, you can select the metric or unit you want to measure the distance between two points in.

Select the API you’d like to use when calculating the distance using the Choose API dropdown menu. Enter your API key in the API Key text field and click on the Check Connection button to ensure proper connection.

Once you’re done, click on the Save changes button to continue.

Step #2: Add locations

Now that you’ve successfully set up the API key for calculating geographical distance, you can start adding your desired locations to WooCommerce. To do this, navigate to WooCommerce > Settings > Distancr and click on the Locations link.

Hide WooCommerce products based on location

Simply click on the +Add Location button and set the Unique Name/ID, Latitude, and Longitude before clicking on the Save Locations button.

Step #3: Set desired product visibility based on the customer’s location

With the desired locations added, you can hide specific WooCommerce products from your store based on the visitor’s geographical location.

Navigate to WooCommerce > Settings > Distancr and click on the Blocklist link from the top.

Set product visibility

Now click on the + Add Rule button and add your desired location using the Location text field. Using the Distance text field, you can pre-set the area you want your customers to be located in for ordering specific WooCommerce products. Set the Block dropdown menu to Products and add your desired product category using the text field right next to it. Additionally, you can add multiple rules for multiple products or locations on your WooCommerce store.

Once you’re done, make sure to click the Save Rules button to apply changes on the front-end.

Step #4: Show/hide payment gateways and shipping methods

Similarly, you can also create Distancr Blocklists for payment methods and shipping methods on your WooCommerce store. For instance, you can offer cash on delivery and free shipping for users that are located within 50 kilometers of your locality.

Payment gateways visibility

Click on the add rule and set the Location and Distance fields as desired. Now select Payment Gateway or Shipping Method using the Block dropdown menu and select your payment gateway or shopping method using the text field right next to it. Once you’re ready, click on the Save Rules button to continue.

Step #5: Modify prices

The Distancr plugin also offers an easy way to set up custom price rules on your online store. This lets you conveniently change or modify the prices of your WooCommerce products and offer exclusive discounts based on the customer’s geographical location.

To do this, navigate to WooCommerce > Settings > Distancr and click on the Pricing link.

Modify prices based on visitor location

Click on the + Add Rule button and set important fields including Location and Distance. You can also set the Priority field that lets you override other rules that have lesser priority. Using the Discount Type dropdown menu, select % (Decrease) to offer a percentage-based discount and add the specific category using the Product Category text field.

Once you’re done, click on the Save Rules button to continue.

Conclusion

Hiding WooCommerce products based on the user’s location might be a great idea if you’re looking to sell to international as well as local customers. However, it’s not possible to use the default WooCommerce functionality for this. Instead, you can use a geolocation plugin such as Distancr to hide products based on the customer’s geographical location.

This way, you can hide WooCommerce products, shipping methods, and payment gateways based on the user’s geographical location. As a result, you enhance the shopping experience on your WooCommerce site, boost sales for your business, and expand your customer base.

Ready to start hiding WooCommerce products based on visitor location? Get Distancr today!