This WooCommerce plugin allows store owners to restrict product visibility and purchasing options based on the customer’s country. By setting country restrictions per product, you can control which products are visible and purchasable for customers from different locations, ensuring compliance with regional regulations and tailored sales strategies.
The plugin helps WooCommerce store owners manage their product availability by country, preventing customers from viewing or purchasing products that should not be sold in their region. This improves user experience, avoids legal issues, and optimizes stock allocation by region.
Features
- ✅ Restrict product visibility on the shop page based on customer country.
- ✅ Block restricted products from being added to the cart or purchased.
- ✅ Admin interface to set restricted countries per product using country codes.
- ✅ Frontend notification when a product is unavailable in the visitor’s country.
- ✅ Automatically detects customer country via session, user billing info, or IP geolocation.
- ✅ AJAX support for setting customer country dynamically.
- ✅ WooCommerce-compatible and integrates seamlessly with product and cart workflows.
How to Install
- 1️⃣ Upload the plugin folder to the
/wp-content/plugins/
directory or install via the WordPress plugin uploader. - 2️⃣ Activate the plugin through the ‘Plugins’ menu in WordPress admin.
- 3️⃣ Go to any product’s edit page and find the “Restricted Countries” field under the general product data tab.
- 4️⃣ Enter comma-separated country codes (e.g., US, IL, DE) where the product should be restricted.
- 5️⃣ Save the product. The restrictions will apply automatically on the frontend and during checkout.
How It Works
- The plugin detects the customer’s country via session data, logged-in user billing country, or IP geolocation.
- On the shop page, restricted products are hidden from users based on their country.
- ⚠️ During cart and checkout, restricted products trigger an error notice and prevent purchase.
- ℹ️ On single product pages, a notice informs customers if the product is unavailable in their country.
Ideal For
- WooCommerce stores that sell internationally but need to limit product availability by country.
- ⚖️ Businesses complying with export/import regulations or regional sales restrictions.
- Stores managing stock allocation or licensing by geography.
- ️ Vendors who want to offer tailored catalogs for different markets.
What Customers See
- Products restricted for their country will be hidden from shop listings.
- ❗ If a restricted product is accessed directly, a clear notice informs them that the product is unavailable in their region.
- Attempts to add restricted products to the cart or checkout will show an error message blocking the purchase.
Important Notes
- Country codes must be entered as ISO 2-letter codes, comma separated (e.g., US, GB, FR).
- IP geolocation depends on WooCommerce’s built-in geolocation feature, which requires the MaxMind GeoIP database or compatible services.
- ⚙️ The plugin relies on PHP sessions; ensure your server supports sessions for accurate country detection.
- Restrictions only apply to the frontend and cart; admin users can always view and edit all products.
Support and Customization
For help or feature requests, please contact me via the contact form on the plugin page at CodeCanyon. I will respond as soon as possible.
Download Country-Based Product Restrictions for WooCommerce