In this tutorial, we will show you how to hide WooCommerce product reviews by city. With this location restriction, some cities will be able to view the product reviews in your store, and other cities won’t.
We will do it using the WooCommerce Product Restrictions by City plugin. This plugin allows you to restrict products, variations, categories, and coupons by city, zip code, store location, state, province, or using custom locations. In this case, it’ll be useful to hide the product reviews by city.
You can download the plugin here:
Download WooCommerce Product Restrictions by Zip Code Plugin - or - Read more
Once you install and activate the plugin, you need to follow these simple steps to hide your product reviews by city.
1- Set up the city restriction method
We need to start by establishing what type of content in our store we are going to restrict and how we are going to do it. In this case, the restriction by city will affect our products.
Go to WooCommerce > Settings > Restrictions by location.
Once there, you need to select the following values to set up the city restriction method:
- I want to restrict: Products and variations
- I want to restrict by: Custom list of locations
- Now you need to enter all the cities where you will hide the product reviews.
After that, scroll down and select:
- What happens when the user location is unknown: You can show or hide all products.
- Hit Save changes.
2- Set up the hide reviews by city settings
Once you have set up the global settings, you need to move to the Products per location tab and select the following values:
- Sell in selected locations: No
- What happens when a customer location is restricted: Hide product reviews
- Hit Save changes.
3- Hide WooCommerce product reviews by city
Now that you have configured the global options to hide product reviews by city, you need to proceed to edit the products where you want to hide reviews for specific cities.
Let’s open a product, and select the Location restrictions under Product data > General:
- Selected locations: Enter the cities here.
- Available in selected locations: No
- Update the product.
Important – Although we will select NO here, your customers will be able to purchase the product because we just selected the Hide product reviews value in What happens when a customer location is restricted above.
Once the restriction is applied to the products, you can visit the store as a normal customer. If the customer comes from a city that is not allowed, he will see the product and all its information, but without the product reviews.
On the other hand, if you select a city that is not restricted, the customer will see the product reviews without any problem.
This is how you can easily hide WooCommerce product reviews by customer city. WooCommerce Product Restrictions by City makes it really easy for you to apply location restrictions to your WooCommerce products.
You can download the plugin here:
Download WooCommerce Product Restrictions by Zip Code Plugin - or - Read more