Let’s learn how to restrict products by shipping country, which is useful if you don’t want to ship your products to a specific country. Let’s learn how to restrict products by billing country, which is really useful if you don’t want to accept payments from a specific country.
- Restricting products by billing country: Customers will be able to select the country from which they are visiting the website. We will take that as the billing country to determine if products are restricted for that country. Once in the cart, if customers change the billing country, we will automatically update the restrictions to avoid selling / receiving payments from restricted countries.
- Restricting products by shipping country: When filling out the shipping information at checkout, users can select a different shipping country for which our products may be restricted. Then, what we will do is to synchronize the shipping country with the country selected on the site, so that when updating the shipping country, the product restrictions will be updated automatically, preventing the purchase of those products.
Install WooCommerce Product Restrictions by Location
Formerly known as Country Catalogs for WooCommerce, the WooCommerce Product Restrictions by Location plugin allows you to add product restrictions based on customer location. You can restrict products, variations, categories, attributes, and coupons by country, continent, subregion, state, city, zip code, or using a custom list of locations.
You can download the plugin here: Download WooCommerce Product Restrictions by Store Location Plugin - or - Read more
After installing and activating the plugin, you need to follow the steps in the sections below in order to restrict products by billing or shipping country.
Set up the global settings for product restrictions by location
You need to open the global settings of the plugin by going to WooCommerce > Product Restrictions by Location > Open global settings.
Now you need to select the following values in the General settings tab:
- I want to restrict: Products and variations
- I want to restrict by: Countries/continents
- Now select the countries your users will be able to select on your store. Note – This is not the list of restricted countries, but the list where you plan to sell / restrict your products. Of these countries, some will have restrictions, but not yet.
- Click on Save changes.
Select what happens when the products are restricted
Move to the Products per location settings tab.
Once there, you can select what will happen when a customer location is restricted. Here are some of the options you have:
- Exclude the product from the catalog listing
- Hide the product completely
- Make the product page show the contents from another page
- Redirect the product URL to another URL
- Show a custom message on the custom page
- Show a message in the checkout page
- Remove the product from the cart and checkout
- Remove the add to cart button from the store and product pages
- Hide the product price from the store and product pages
- Hide the product reviews
- Remove the product link from menus
In this example, we will tick these checkboxes:
- Remove product from the cart and checkout
- Remove add to cart
- Hide product price
Once we’re done here, let’s Save changes.
How to restrict products by billing country
Now it’s time to apply some country restrictions to our WooCommerce products.
a) Global restriction
We can restrict all products to specific countries. This is great because it allows us to save a lot of time applying restrictions per country.
In the Products per location tab, we need to enter the countries for which our products will be unavailable.
In this example, we will block our products from being accesses from El Salvador and Italy.
We need to select No in Sell in selected locations and Save changes.
When you restrict all the products from your store for specific countries, users will view the products, but they won’t be able to add the products to the cart nor view the product prices. In case a user had products on the cart at the moment of applying this restriction, the products will be removed.
Of course, everything depends on what you have selected in What happens when a customer location is restricted.
b) Individual restriction
If, instead of restricting all products, you want to restrict specific products only, you don’t need to add the countries globally, because this is done on a product-by-product basis.
Go to Products > All products in wp-admin.
Open a product you want to restrict.
Select these values in Product data > General > Location restrictions:
- Selected locations: Add the countries where you want to restrict this product.
- Available in selected locations: No.
- Update the product.
On the product page, users from restricted countries won’t see the product price nor the add to cart button.
You can also add a message saying that this product is not available for the selected country.
On the catalog, all products will display the price and add to cart button, except for the restricted products.
How to restrict products by shipping country
What we will do in this section will apply whether you restrict products globally or individually for each product.
To restrict products by shipping country, you need to go to WooCommerce > Product Restrictions by Location > Open global settings.
Once there, you need to move to the Restriction enforcement tab.
And you need to select Yes in the Sync the location detection with the shipping information field.
Enabling this will do this:
- When customers select a location in the selector, that location will be automatically selected as the shipping location.
- And when they change the shipping location in the checkout page, it will automatically be selected on the dropdown selector.
This way, the product restrictions will update automatically, and you’ll avoid shipping products to restricted countries.
This is how you can easily restrict products by shipping or billing country in WooCommerce, with the WooCommerce Product Restrictions by Location plugin.
You can download the plugin here: Download WooCommerce Product Restrictions by Store Location Plugin - or - Read more