=== Product Country Restrictions for WooCommerce - Country Catalogs ===
Contributors: vegacorp,josevega
Tags: woocommerce, country restrictions, geolocalization
Tested up to: 6.8
Stable tag: 1.15.4
Requires at least: 3.6
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Restrict or hide WooCommerce products by country, create country catalogs.

== Description ==
This plugin is the perfect tool for creating Country Catalogs. You can geolocalize your WooCommerce store and offer different products based on the country of the user.

Are you creating a WooCommerce store and you want to restrict products to specific countries?

This plugin lets you sell WooCommerce products to specific countries.

**This plugin works with WPML automatically.**

= Why do I need special country catalogs? =

Simple, to make more money :)

Sell WooCommerce products with higher prices for the United States, and lower prices for India or developing countries.

Sell your digital products globally and the physical version in your home country.

= How does it work? =

When you create or edit products, you will have the option to sell the product to a list of countries, or not sell the product to a list of countries.

When a product is available for a country, only users from that country can view the product and buy it. The same thing happens for restricted products.

Restricted products are completely hidden from the blacklisted country. They are removed from the product catalog, product category, product search, etc. The people from the disallowed country can´t see the product at all.

You can use this for a lot of purposes.

= Use cases =

* Create country catalogs easily

* Sell different product categories for each country

* Sell WooCommerce products with higher prices for the United States, and lower prices for India

* Offer products with different Attributes, Variations, Pictures, and Prices to different Countries

* Change product descriptions and titles based on the country of the user

* Apply the country restrictions to every product

* This works with Simple Products, Grouped Products, and External Products

* In the free version there´s no global settings, you need to edit every product manually

* And more...

= Premium features =

[Try Premium Plugin for FREE for 7 Days](https://wpsuperadmins.com/plugins/woocommerce-country-catalogs-restrictions/?utm_source=wp.org&utm_campaign=readme.txt&utm_medium=web)

**Advanced geolocation options:**
Auto detect country by IP
Show country selector in the header and let users view the country catalogs
Use the shipping country
Use the billing country
Allow to use a second geolocation method as a fallback, for example, shipping country + auto detected ip

**Restrict by country, continent, subcontinent, and states**

**Advanced restriction options:**
Hide products from the shop catalog, category page, search, and product page
Show products and disable "add to cart"
Show products and disable "add to cart" and hide prices

**All product types supported**
Example. Variable Products = Restrict variable products and individual variations by country.

**Hide individual Product Variations by Country**
Offer a "large size" to Spain, "Small size" to Germany
Offer a "physical product" to your home country, and "digital (downloadable)" option to the other countries
Offer a print / delivery to your home country, and digital only to other countries
Show different variation pictures and product dimensions for different countries

[Try Premium Plugin for FREE for 7 Days](https://wpsuperadmins.com/plugins/woocommerce-country-catalogs-restrictions/?utm_source=wp.org&utm_campaign=readme.txt&utm_medium=web)

**Hide product categories by Country**
You have a menu with the categories: Music, Movies, and Apps.
You can hide the "Music" catalog for Canada, and show the "Movies" catalog for USA.
This will automatically remove the category from the menus, categories list, product pages, etc.
You can select if you want to hide the category catalog only or hide category and all products under the category.

**Restrict Coupons by Country**
You can create coupons for specific countries, continents, or regions. I.e. Coupons for Europe, Canada, etc.

**Bulk Edit Products by Category**
You can hide all products under the category "Music" for Canada, and show all products under category "Videos" for USA only.

**Global settings page**
You can apply country restrictions to all products automatically. No need to edit every product manually.

You can hide all products for specific countries, or sell products to specific countries.

You can also hide all variations by attributes for specific countries. For example, make all "size large" available to USA only, this applies to all products at once.

[Try Premium Plugin for FREE for 7 Days](https://wpsuperadmins.com/plugins/woocommerce-country-catalogs-restrictions/?utm_source=wp.org&utm_campaign=readme.txt&utm_medium=web)

== Installation ==
= Automatic installation =

Automatic installation is the easiest option as WordPress handles the file transfers itself and you don’t need to leave your web browser. To do an automatic install log in to your WordPress dashboard, navigate to the Plugins menu and click Add New.

In the search field type the plugin name and click Search Plugins. Once you’ve found our plugin you can install it by simply clicking “Install Now”.

= Manual installation =
The manual installation method involves downloading our plugin and uploading it to your webserver via your favourite FTP application. The WordPress codex contains [instructions on how to do this here.](https://codex.wordpress.org/Managing_Plugins#Manual_Plugin_Installation)


== Frequently Asked Questions ==

= What type of products can I use this plugin on? =

The free version works with simple, grouped, external products.

The [premium version](https://wpsuperadmins.com/plugins/woocommerce-country-catalogs-restrictions/?utm_source=wp.org&utm_campaign=readme.txt&utm_medium=web) works with all product types.

== Screenshots ==
1. Settings in the product editor

== Changelog ==

= 1.15.4 - 2025-07-10 =
* CHANGE - Add option to use a popup instead of dropdown in the header
* CHANGE - Add option to show only the country abbreviation in the header
* FIX - PHP warnings in php 8.4
			
= 1.15.3 - 2025-01-27 =
* CHANGE - Update plugin sdk
* FIX - Minor bug fixes
			
= 1.15.2 - 2024-10-24 =
* CHANGE - Small bug fixes
* CHANGE - Update dependencies
* CHANGE - Apply restrictions to the Google Feed created by the plugin google-product-feed
			
= 1.15.1 - 2024-04-03 =
* CHANGE - Small bug fixes

= 1.15.0 - 2024-04-03 =
* NEW - Added compatibility with the WooCommerce Checkout Block
* CHANGE - Enable restriction features on product tags
* CHANGE - Improve compatibility with DooFinder
* CHANGE - Mark the plugin as compatible with HPOS

= 1.14.3 - 2023-07-05 =
* CHANGE - Updated Freemius SDK
* FIX - Small bug fixes

= 1.14.2 - 2023-01-06 =
* CHANGE - Updated Freemius SDK
* FIX - Small bug fixes

= 1.14.1 - 2022-09-06 =
* CHANGE - Allow to use a custom base country for the state restrictions
* CHANGE - Compatibility with WC 6.8

= 1.14.0 - 2022-07-26 =
* CHANGE - Improve compatibility with WC shortcodes
* NEW - Add shortcode [wccr_current_country]

= 1.13.1 - 2022-05-25 =
* CHANGE - Cache support - Don't hide the variation attributes when the product is restricted

= 1.13.0 - 2022-03-01 =
* NEW - Allow to display custom page in category pages
* NEW - Compatibility with WCFM
* CHANGE - Support for the plugin "PW Woocommerce Advanced Gift Rules"
* CHANGE - Support for the plugin "Aelia Currency Switcher for WooCommerce"
* CHANGE - Add option to not allow to close the popup selector without selecting a country
* CHANGE - MInor improvements for the country selector
* CHANGE - Upgraded Freemius SDK to v2.4.3
* FIX - When we edited a category with category-only restrictions, it was removing the custom restrictions from products using the category
* FIX - Sometimes the categories aren't restricted in some listings

= 1.12.3 - 2021-07-01 =
* CHANGE - Selector - Allow to display abbreviations
* CHANGE - Selector - Automatically change the currency for the plugin "price based on country" by Oscar Gare

= 1.12.2 - 2021-05-12 =
* FIX - Country selector does not load sometimes
* FIX - States restrictions don't apply correctly when we update the state in the cart page

= 1.12.1 - 2021-03-08 =
* CHANGE - Improve translations
* CHANGE - Improve wprocket integration
* CHANGE - Improve mobile styles of popup
* CHANGE - Prevent minor configuration errors
* FIX - Country selector doesn't load the first time when we are using cache compatibility

= 1.12.0 - 2020-12-28 =
* NEW - Improve handling of restrictions
* CHANGE - Improve the header selector dropdown

= 1.11.2 - 2020-10-27 =
* FIX - Cache support loads too late when using the country selector

= 1.11.1.2 - 2020-09-30 =
* Small bug fixes


= 1.11.1 - 2020-09-25 =
* CHANGE - Improve the display of restricted page
* FIX - Sometimes it applies the restrictions to admins during ajax requests
* FIX - Sometimes the country selector popup doesn't close due to conflicts with other plugins

= 1.11.0 - 2020-08-17 =
* NEW - Allow to add intro text to the country selector popup
* FIX - Country selector popup - Sometimes the locations are hidden
* FIX - The country selector location option in the settings page is not saving the right value sometimes
* FIX - Add support for WP 5.5

= 1.10.4.1 - 2020-07-31 =
* FIX - Category - sometimes the restriction fields are not saved
* FIX - Apply restrictions to ajax requests

= 1.10.4 - 2020-06-29 =
* CHANGE - Improve the dokan support
* CHANGE - Improved performance
* FIX - Country selector popup has wrong height on firefox

= 1.10.3 - 2020-05-28 =
* NEW - Improve the restrictions when creating orders
* CHANGE - Improve the handling of restricted category pages
* FIX - Country selector popup - The current name is duplicated sometimes
* FIX - Sometimes the login form submission fails when using the cache support

= 1.10.2 - 2020-04-07 =
* CHANGE - Improve the cache support
* CHANGE - Improve the display of the country selector
* CHANGE - Cache support - Allow to deactivate the allowed variations redirection
* CHANGE - Improve the handling of inherited category restrictions
* CHANGE - Improve the design of the settings page
* FIX - Cache enabled - When the product is restricted and individual variations are enabled, the product restriction is not applied
* FIX - Shipping country syncing - Sometimes it didn't work
* FIX - Incorrect country detected sometimes

= 1.10.1 - 2020-02-25 =
* FIX - The dropdown selector is cached in the sessionStorage so any country we select is overwritten by the first country cached
* FIX - Cache support - the body classes are not updated with the ajax call

= 1.10.0 - 2020-02-25 =
* NEW - Allow to select which attribute is used for country restrictions and hide the attribute from the user 
* NEW - Add country selector popup
* CHANGE - Cache support - When the visitor is allowed to buy variations after the ajax call, refresh the price range to not show prices of disallowed variations
* CHANGE - wccr_country shortcode - Allow to use continents
* FIX - Cache support - When all the variations are restricted for the user, don't show the add-to-cart form with dropdowns only to later say the variations are not allowed. Show the product restricted message and hide the form/prices according to the settings
* FIX - Country selector - When we select continents or regions in the settings, the dropdown doesn't appear in the frontend
* FIX - When we calculate shipping in the cart page and the country selector is synced with the shipping, it doesn't update the country of the user

= 1.9.0 - 2020-01-23 =
* NEW - Dokan integration - Add option "Products created by vendors are allowed for the country of the vendor?".
* NEW - WP Optimize Cache integration to keep separate cache by country
* CHANGE - Add body class with the current shipping and billing country to faciliate the debugging/technical support
* CHANGE - When a product is restricted and the product pages are hidden, remove the link from the menus too
* CHANGE - Added "Aland Islands" to the list of countries
* CHANGE - Show the custom message in the cart page saying "product not allowed for your country" instead of the default message from WooCommerce
* CHANGE - Cache support - Only hide the prices and add to cart on product pages
* FIX - Cache support - When the restriction method is "disable add to cart and show prices", the prices are hidden by mistake
* FIX - Country selector - Don't reload the page when clicking on the current country
* FIX - Sync country with shipping/billing country - When we add a product to the cart it sets the shipping/billing country with the default, not with the selected country in the dropdown
* FIX - The country selector shortcode doesn't work for administrators
* FIX - The [wccr_country] shortcode doesn't work for administrators
* Fix - Bug from WC Core. When the option "Default customer location=geolocate", WC sets the shipping/billing country as the full name but we expect a 2 digit code
* FIX - When we edit a category with empty restrictions, it unsets the restrictions from individual products using the category

= 1.8.0 - 2019-12-28 =
* NEW - Allow to restrict products per country based on the global attribute
* NEW - Allow to restrict global attributes by country
* NEW - Added support for WooCommerce Blocks (gutenberg)
* CHANGE - Cache support - When the page loads, hide the price and add-to-cart forms and show them after we verified the product is allowed
* CHANGE - Added support for Sucuri
* CHANGE - Make the shortcodes available during ajax requests
* FIX - The global restrictions for variations are not applied when a variation doesn't have a specific attribute value (i.e. it has "any size")

= 1.7.0 =
* NEW - Added option to restrict by state
* FIX - Country selector - Sometimes when floating-flags mode is active, the mobile version doesn't have dropdowns
* FIX - Country selector - Sometimes when the page loads, the country selector links to the home
* FIX - Modify the is_purchasable product property only when the product is restricted to avoid overriding changes from other plugins
* FIX - Country selector - When we select a country and the page loads, woocommerce overwrites it with the previous country using the dropdown from the session storage


= 1.6.2 =
* FIX - When the cart or order is updated, the country selector is updated with links having the wrong URL

= 1.6.1 =
* NEW - Added automatic support for WPML
* CHANGE - Improve the cache support so proxies don't cache the ajax call
* CHANGE - When the cart or order is updated, updated the country selector in case the current country changed
* FIX - The general price shown in variable products is cached, so when user switches country it's not reflecting the real price.
* FIX - The restriction is not executed when the order is updated on rare scenarios when using the option "Sync the country selector with the shipping country?".

= 1.6.0 =
* NEW - Added compatibility with WPRocket
* NEW - Added option to disable the removal of restricted products in the checkout page
* NEW - Country selector - Use the country from the IP as default country if the option is empty
* NEW - Added feature to restrict coupons by country, continent, or region
* NEW - Added option to enable restrictions on REST API endpoints
* NEW - Added limited compatibility with all cache systems (apply restrictions via ajax on product pages).
* CHANGE - Don't apply restrictions on REST API endpoints by default
* FIX - Allow to unset the "Country selector: Default country" option.

= 1.5.2 =
* FIX - Sometimes WC initializes and the helpers haven't loaded causing a fatal error
* FIX - Added 9 missing flags for the country selector

= 1.5.1 =
* CHANGE - Don't apply the restrictions to REST API requests
* FIX - When we save products with empty restrictions, sometimes it saves it as an array with empty string making it think it is restricted
* FIX - Improved the method for reading CSVs, the old caused php warnings when allow_furl_open was disabled

= 1.5.0 =
* NEW - Added shortcode [wccr_country countries="US,ES" disallowed="0"]text[/wccr_country] to allow to display custom description and short description per country (premium)
* NEW - Added option to not apply country restrictions to selected user roles (premium)
* NEW - Allow to select entire continents in the backend options as a shortcut
* NEW - Allow to select entire regions in the backend options as a shortcut
* NEW - Allow to select entire sub regions in the backend options as a shortcut
* NEW - Added option to link the country selector with the shipping country (premium)
* NEW - Added option to change the "product not allowed for your country" message (premium)
* FIX - The "add to cart" was appearing when we viewed a variable product from a restricted country (premium)
* FIX - Allow to remove the fallback geolocation method, dont force IP as default. (premium)
* FIX - Some UN countries were missing from the list

= 1.4.0 - 2019-05-01 =
* NEW - If we allow to view restricted products, show a notice on the product page saying "the product is not allowed for your country"
* NEW - Added support for all variation types added by other plugins (i.e. subscription_variations) (premium)
* NEW - Added option to use a fallback geolocation method in case the primary geolocation can't find the user country (premium)
* NEW - Added option to select if the products are shown or hidden when the user country is unknown (premium)
* NEW - If the geolocation method is shipping/billing country, use the country from the logged in user's profile (premium)
* NEW - Added option to save multiple rules for hiding/showing variations globally (premium)
* NEW - Added shortcode [vcwccr_country_selector] to display the country selector anywhere (premium)
* CHANGE - Clear the country cookie when we change global settings to avoid geolocation errors when testing new settings and using old cookies (premium)
* CHANGE - Country selector - Use the shipping countries from WooCommerce settings for the list as default (premium)
* CHANGE - Country selector - If we couldn't find a menu from the settings or automatically, show it as a floating dropdown at the top right corner (premium)
* CHANGE - Country selector - Added compatibility with the uber menu plugin (premium)
* FIX - Country selector - some countries don't have flags (premium)
* FIX - Country selector - initialize a second time to make it work with "late menus" (premium)
* FIX - Product variations metabox - We can't remove the selected country, it always comes back (premium)
* FIX - Product variations restriction - Sometimes variations were disabled when the country field was empty (premium)

= 1.3.0 - 2019-03-16 =
* NEW - Allow to regenerate country cookie by appending ?wcacr_reset=1 to any url
* NEW - Settings - Allow to select a page to display when a product is restricted so we can display custom messages
* FIX - Geolocation issue on sites hosted by hostgator
* FIX - Make products shortcode cache unique for each country

= 1.2.4 - 2019-03-04 =
* FIX - The country selector JS initializes too late preventing it from using the theme js logic.
* FIX - PHP warning

= 1.2.3 - 2019-03-01 =
* FIX - Bug on the restriction logic during checkout

= 1.2.2 - 2019-02-28 =
* CHANGE - Added option to select menus for the country selector

= 1.2.1 - 2019-02-26 =
* CHANGE - Added a link to global settings on the product metabox to improve UI
* CHANGE - Updated freemius SDK to v2.2.4
* CHANGE - Clear WooCommerce's cache when a post's country restrictions are updated
* FIX - Country restrictions per category - It doesn't update all the products
* FIX - Products weren't excluded on the frontend if the products list used post__in
* FIX - Sometimes the country selector doesn't look like a dropdown when themes use a different html structure for dropdown menus
* FIX - Country restrictions per category - When a product is created/updated, apply the country restrictions from the assigned category
* FIX - Country restrictions per category - When we remove a category from a product, if the category had restrictions, remove the restrictions from the product

= 1.2.0 - 2019-02-17 =
* NEW - Added geolocation option: Use the shipping country (premium)
* NEW - Added geolocation option: Use the billing country (premium)
* NEW - Added geolocation option: Display a country selector in the header so the user can switch between country catalogs (premium)
* NEW - Added restriction option: Allow to show products and disable "add to cart" (premium)
* NEW - Added restriction option: Allow to show products and disable "add to cart" and hide prices (premium)
* CHANGE - Category - Separate section with <hr>, it doesn't standout between custom fields added by other plugins (premium)
* FIX - Categories - Allow to save country field empty and reset product meta (depending on the "apply to" field) 
* FIX - Products - Allow to clear the country field to reset restrictions

= 1.1.2 - 2019-02-12 =
* CHANGE - Replace our geolocation library with WC's built-in geolocation class
* CHANGE - Add country as body class, so we can hide elements by country with css
* CHANGE - Add non-persistent cache for the disallowed products list to improve performance
* FIX - Exclude common bots from geolocation by user agent.
* FIX - Improve the product filtering logic. Sometimes hidden products appeared on some themes' lists

= 1.1.1 - 2018-12-29 =
* FIX - when product metabox is saved initially, the country restriction doesnt work
* CHANGE - Improved instructions on welcome page and global settings

= 1.1.0 - 2018-09-19 =
* Added option to restrict individual product categories by country
* Added option to bulk edit products by category

= 1.0.1 - 2018-09-19 =
* Save countries as string separated by commas instead of serialized array

= 1.0.0 - 2018-09-09 =
* Initial release