WooCommerce – Restrict Categories by State or Province

This tutorial shows you how to restrict categories by state or province in WooCommerce. For example, you may want to sell all products for all states in the United States, but restrict the Technology category for specific states.

We will do this with Country Catalogs for WooCommerce.

This plugin allows you to apply country, continent, or state restrictions for all your products, categories, variations, and coupons to create different catalogs. Also, you can show different descriptions for your products.

You can download the plugin here:

Download Country Catalogs for WooCommerce Plugin - or - Read more

Once you install and activate the plugin, follow these simple steps.

Step 1. Set up the global settings to restrict your categories by state or province

We will start by setting up some global settings that will allow us to restrict product categories by state or province.

For this, go to WooCommerce > Settings > Country Restrictions.

Once there, select the following values under General:

  • Geolocation method: We will show a state selector in the header.
  • Restrict by: States or provinces of one country.
  • Hit Save changes.
restrict categories by state woocommerce

Some important notes:

  • The restriction by country works perfectly with all countries with all geolocation methods.
  • Check the notes below the Restrict by field to know which countries accept the restriction by state or province.
  • The restriction by state does not work with IP geolocation (automatic detection) because the automatic detection is unreliable for small states, it only works with the dropdown selector (the user selects the state in the dropdown on the header), billing state, and shipping state.
  • The list of states will be from the “base country” defined in the WooCommerce settings. Your base country is United States (US), you can change it to WooCommerce > Settings > General > Store Address > Country.

Step 2. Restrict your categories by state or province

Once you’ve selected the global state restrictions, you can proceed to restrict your categories by state or province.

Go to Products > Categories in wp-admin, and open the category you want to edit.

Now you need to select the following values to restrict your selected category:

  • Select countries: Here you need to select the states where your categories will be restricted.
  • Available in selected countries: No
  • Apply this to: Category and products
  • Hit Save to apply the changes.
restrict categories by state woocommerce

Once you restrict your category, it will disappear from the website and the store. For example, we have restricted the Accessories category.

You can set up a popup to ask the customers to select their state when they visit your WooCommerce store.

restrict categories by state woocommerce

As you can see, if we select any of the states where our category is not restricted, it appears without any problems in the navigation menu and sidebars.

restrict categories by state woocommerce

However, if we select any of the restricted countries, you will see that the restricted category will disappear completely from the site.

restrict categories by state woocommerce

Done!

Restricting WooCommerce categories by state or province is really simple if you use the Country Catalogs for WooCommerce plugin.

You can download the plugin here:

Download Country Catalogs for WooCommerce Plugin - or - Read more