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 US except the products from the Technology category.
Of course, you can’t do this manually in WooCommerce. Therefore, we’ll show you how to do it using 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.
Once you install and activate it, follow these simple steps.
Step 1. Open the plugin’s global settings
You need to go to WooCommerce > Advanced Country Restrictions and click on Open global settings.
Step 2. Select how you’ll restrict the categories
Now select State in Restrict by.
The list of states will be from the “base country” defined in the WooCommerce settings. If you want to change it, just go to change the base country, go to WooCommerce > Settings > General > Store Address > Country.
Step 3. Select the state restriction settings
- Geolocation method: Show country/state selector in the header
- Restriction method: Here we have three options
- a) Hide product from the catalog
- b) Show product in catalog, disable add to cart, show prices
- c) Show product in catalog, disable add to cart, hide prices
- Let’s select the third option as an example.
- Dropdown selector options: Select the states that you want to display in the list. Leave it empty to display the shipping countries from the WooCommerce settings.
- Dropdown selector: Select the default state you want to show in the selector.
- Finally, click on Save changes.
Step 4. Edit the category state restrictions
Once you’ve selected the global state restrictions, you need to select the state restrictions for each category.
Go to wp-admin > Products > Categories and open the category you want to edit.
For example, if you open the Technology category, you need to go to Country restrictions.
- Selected countries: Select the states where you want to restrict the categories. In this case, we’re selecting California.
- Available in selected countries: No
- Apply this to: Category and products
- Save changes
With these values, customers will see that the products in the Technology category are available for Alabama and any other state, but they’re unavailable for California.
This will be the result when users visit the website:
Available for Alabama
Unavailable for California
You can enable a popup to be displayes when users open the website for the first time. This popup will contain the different selected states and ask the users to choose their county/state.
You can enable this popup going to Global Settings > Dropdown selector: Display a popup asking the user to select a country? And select Yes.
It’s really simple to edit set and state restrictions for your WooCommerce product categories. You don’t need to use any codes. Just some simple steps, and done.