WooCommerce – Stock and Inventory Based on the User Country

In this tutorial, we want to show you how to show different WooCommerce stock based on the country of the customer.

For example, let’s say you want to show a specific inventory to the United States and another to the rest of the countries where you sell your products. You may even want to create a specific inventory for each country where you sell your products.

That is impossible with WooCommerce only. Fortunately, we will use the WooCommerce Product Restrictions by Location plugin, which allows you to create different conditions to restrict products, variations, categories, coupons, attributes etc., for different countries, continents, subregions, etc.

After installing and activating the plugin, just follow these simple steps to display a different stock per country.

1- Edit the plugin’s global settings

To edit the plugin’s global settings, go to WooCommerce > Advanced Country Restrictions and click on Open global settings.

woocommerce stock per country

Now go to the General settings tab and select these values:

  • I want to restrict: Tick the Products and variations checkbox.
  • I want to restrict by: Select the Countries/Continents option.
  • Now select the countries to which you sell your products. For example, if you sell to Canada, United States and Mexico, you need to add the three countries here.
  • Click on Save changes.
woocommerce stock per country

2- Create a Country product attribute

We will be able to show different stock per country by creating different variations and restricting them based on the country. This means we need to first create an attribute called “Country”.

Go to Products > Attributes.

Go to Products > Attributes and create an attribute called Country.

Now you need to add attribute terms for each country where you’ll define a specific stock. To simplify this process, in this example we will create a country term for the United States and another country term for the rest of the World.

woocommerce stock per country

3- Create a variation for each country term

We need to create a variable product or turn simple products into variable in order to display different stock per country or continent.

For this, we need to go to Products and open the product we want to edit and do this:

Now move to the Attributes tab in Product data, add the Country attribute to the product, seleect

  1. Move to the Attributes tab in Product data.
  2. Add the Country attribute to the product.
  3. Select the country values
  4. Make sure you tick the Used for variations checkbox.
  5. Click on Save attributes.
woocommerce stock per country

Now go to the Variations tab and do create a variation for each country where you want to show a different inventory. In his example, since we have only two country terms, we will create two variations (one for the United States and one for the World attribute):

woocommerce stock per country

4- Set different stock per country

Now we need to start editing the variations that we have created for different countries. In this example, we only have two variations, but you can have a different variation for every country where you sell your products if you want to show a different inventory quantity by country.

Let’s open the first variation where we want to show a specific stock and do this to edit the stock:

  1. Tick the Manage stock checkbox.
  2. Add the stock in the Stock quantity field.
woocommerce stock per country

Now let’s move to the Location restrictions section and select the following values:

  • Selected locations: Add the countries for which this variation will not be available.
  • Available in selected locations: No.
woocommerce stock per country

Now it’s time to edit the variations for the rest of the world. This one should be available for all countries, but not for the United States:

  1. Tick the Manage stock checkbox.
  2. Add the stock in the Stock quantity field.
woocommerce stock per country

Now let’s move to the Location restrictions section and select the following values:

  • Selected locations: Add the countries for which this variation will not be available.
  • Available in selected locations: No.
woocommerce stock per country

5- Recommended – Hide the Country attribute from the front-end store

Our plugin allows you to hide the attributes you use for storing the location of the customer. This way, your customers won’t see there’s a different stock for different countries, since they won’t be able to select the attribute on the product page, as they normally do with variable products.

Go to WooCommerce > Variations per location and select the Country attribute in the field called Variations: Select the attribute used for storing the location to hide it.

Once you do that, click on Save changes.

woocommerce stock per country

6- See the result: different inventory per country or continent

Our plugin allows you to configure a popup selector to ask customers to choose their country when they visit your store.

woocommerce stock per country

You can also add a dropdown country selector to your navigation menus.

woocommerce stock per country

You can follow this guide to learn how to set up the popup and the dropdown selector.

Let’s see how it works then!

When users have selected their country on your website, they will see a different stock quantity for every country.

For example, if they select the United States, they will see that we have 150 units in stock.

woocommerce stock per country

However, if they select any other country, they will see a different stock quantity.

woocommerce stock per country

Important. In this example, we have used two variations only, but you can create a variation for each country and just play with the restricted countries.

As you can see, adding different stock per country in WooCommerce is simple with the WooCommerce Product Restrictions by Location plugin. You don’t need to be a programmer or experienced developer. It’s simple and no code.

You can download the plugin here:

Download Country Catalogs for WooCommerce Plugin - or - Read more