Let’s see how to hide WooCommerce products by country. We will automatically hide the products from the catalog when users select a restricted country.
When users select a restricted country on your WooCommerce store, they won’t see any products because the visibility will be blocked. Instead, they will see a message telling them there are no available products for their location.
But if they select a country for which product visibility is available, they will see the products in the catalog.
WooCommerce product visibility by country or continent
Adding product visibility by country in WooCommerce is great to hide products for specific countries and show them for other countries. It allows you to create different product catalogs for different countries.
This can be useful when some of your products are not allowed in a specific country, or when shipping taxes are really high in a country, and you prefer not to ship your products to that country.
However, WooCommerce doesn’t allow you to create product catalogs based on the country of the customer, so you will need some help, and we can help you 🙂
The WooCommerce Product Restrictions by Location plugin allows you to add conditional visibility to your WooCommerce products.
You can restrict product visibility by country or continent, zip code, states or provinces from one location, or using a custom list of locations.
In this case, it will allow you to hide products from the catalog based on the customer country. It’s like creating different catalogs or stores per country using the same WordPress site.
After installing and activating the WooCommerce Product Restrictions by Location plugin, follow steps below to hide products by country.
Set up the global settings to hide WooCommerce products by country
The first thing we need to do is configure the global settings of WooCommerce Product Restrictions by Location.
- Go to WooCommerce > Product Restrictions by Location.
- Click on Open global settings.
Once you open the Global Settings, go to General and configure the following values to hide your products by country:
- I want to restrict: Here you can select Products and variations, but you also have the options to restrict/hide category and attribute pages and/or coupons.
- I want to restrict by: Countries/continents
- Please select which countries you want to allow your users to select: Select the countries here. Note. These are not the restricted countries. These are the countries your users will be able to select. Restricted countries come in the next steps.
- What happens when the user location is unknown: You can select any option here.
- Click on Save changes.
After selecting the global settings, you have at least two options to hide your WooCommerce products by country.
OPTION 1: Globally hide WooCommerce products by country
The first option you have is to globally edit the WooCommerce product visibility by country.
This means you will completely block a specific country from viewing your products on the WooCommerce store.
For this, you need to move to the Products per location tab and select these values:
- Products per location: Select the countries where you want to hide the products from the catalog. When customers select any of these countries on the store, your products will be removed or hidden from the catalog. In this example, we will hide the products for El Salvador, Guatemala, Honduras, Mexico and Nicaragua.
- Sell in selected locations: No
- What happens when a customer location is restricted: Exclude from catalog listing
- Click on Save changes.
Note: Besides hiding products from the catalog, you have other options to select what happens when a customer location is restricted:
- Make the product page disappear completely from the catalog on restricted countries
- Make the product page show the content of another page for restricted countries
- Redirect the product page to a specific URL
- Show a custom message in the product page for restricted countries
- Show a custom message in the checkout page for restricted countries
- Remove the product from the cart and checkout pages
- Remove or hide the add to cart button
- Hide the product prices
- Hide the product reviews
- Remove product link from navigation menus
Once you save the changes, customers from the restricted countries won’t be able to view any products on your store.
When your customers visit your store, they will be asked to select their country using a popup as you can see in the screenshot below.
You can also configure a location selector on any nav menu of your WordPress site. As you can see below, customers can select their country from the nav menu on the website’s header.
In this example, we have selected El Salvador, and no products are displayed on the store because it is one of the countries where we have hidden our products from the catalog.
However, if we select an allowed country such as the United States, all the products in our store will be displayed.
OPTION 2: Individually hide specific products by country
Another option is to hide individual products by country.
In this case, the restriction won’t be global, so we need to open and edit our WooCommerce products individually to hide them by country.
This allows us to create WooCommerce catalogs by country without any problem.
- Go to WooCommerce > Products.
- Open a product you want to hide by country.
As you see in the screenshot below, we will edit the first product that appears on our WooCommerce store (Black Elegant Dress):
We have opened that product, and we will hide it for the following countries: Mexico and Nicaragua.
We just need to select the following values:
- Selected countries: Enter the countries where you want to hide your product.
- Available in selected countries: No
- Update the product to save the changes.
After applying the changes, the edited products will not appear in the catalog of selected products.
For example, we have selected Mexico and the product we edited is not shown in the catalog.
But if we select a country where the visibility of the product in the catalog is not restricted, the product will be displayed without problems.
Hide products from the catalog based on the country!
The WooCommerce Product Restrictions by Location plugin allows you to easily edit conditional product visibility by country.
You can create different catalogs for different countries without any problems. This way, you can use the same store and avoid selling to countries where your products are restricted or avoid shipping to countries where shipping fees are too high.