WooCommerce – Stock and Inventory Based on the User Country

In this tutorial we want to show you how to create and show stock and inventory in WooCommerce based on the country of your users. For example, we are going to show you how to create an inventory for a specific country and another inventory for the rest of the world.

With this simple method you could even create a specific inventory for each country. Of course, if you want to do it with WooCommerce, it’s simply impossible.

Well, even if it’s not impossible, it’s too difficult because you would have to use PHP snippets, which make life difficult for us and make us spend a lot of time trying to get what we want to do.

For this, we’ll use the Country Catalogs for WooCommerce plugin, which allows you to create different conditions to restrict products, variations, categories, etc., for different specific countries.

You can download the plugin here:

Download Country Catalogs for WooCommerce Plugin - or - Read more

After installing and activating the plugin, just follow these simple steps.

1- Edit the plugin’s global settings

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

After that, you need to select Hide products from the catalog in the Restriction method field.

Finally, just click on Save changes.

2- Create a Country product attribute

For this, go to Products > Attributes. Once there, you need to create an attribute called Country. This will be useful to create variations for those attributes.

In that attribute, you can create an attribute for each country where you’ll define a specific stock, or you can create a country and another attribute for the rest of the world. We’ve created a country called El Salvador and another called World.

Once you’re done with that, go to Products and open the product you’ll edit.

3- Make your product variable and select the country attributes

Once you open the product for which you’ll create different stock for different countries, you need to make it variable, select the country attributes, and create the variations you’ll use to show different stock for different countries.

To make the product variable, you need to select Variable product in the Product data dropdown. After that, go to the Attributes section and add the country attributes to the products. You must tick the Used for variations checkbox to use these attributes for the variations you’ll need to create.

Now you need to create the variations. For this, go to the Variations section and add a variation for each country. In our case, we’ll create only two variations: El Salvador and World. Then you just need to edit these variations’ stock and country restrictions.

a) Edit stock and country restrictions for the first variation

The variation for El Salvador must not be available for the rest of the world, so you need to do this to restrict it in all countries except in El Salvador:

Edit the variation stock

You need to open the variation options and then tick the Manage stock checkbox. Next, enter the stock in the Stock quantity field.

Edit the variation country restrictions

Go to the Selected countries field and select all the countries where you want this variation to be restricted. Since this variation is just for El Salvador, you should select all other countries in the Selected countries field. In Available in selected countries you need to select No.

Finally, click on Save changes.

b) Edit stock and country restrictions for the second variation

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 El Salvador.

Edit the variation stock

Open the variation options and tick the Manage stock checkbox. After that, enter the stock in the Stock quantity field.

Edit the variation country restrictions

Now go to Selected countries and select El Salvador. In Available in selected countries you need to select No.

Finally, click on Save changes.

4- See the results

Once you’ve edited the variations, you’ll notice that users visiting your store from El Salvador will be able to see the stock you entered for the El Salvador variation.

On the other hand, users visiting from the rest of the world will be able to see the World variation and its stock only.

Important. We’re dealing with just two variations, but you can create a variation for each country and just play with the restricted countries.

That’s a piece of cake!

You see? That was really simple. You just need to use some fields and follow some simple steps. You can create different stock for all countries you want and don’t need to use PHP snippets nor spend lots of hours.

You can download the plugin here:

Download Country Catalogs for WooCommerce Plugin - or - Read more

Leave a Reply

Close Menu