Description
Country Based Content lets you adapt your WooCommerce store to each visitor’s country. Redirect visitors, hide prices or the add-to-cart button, and adjust prices, all based on the country detected locally by WooCommerce.
Key Benefits
- Local geolocation — Uses WooCommerce’s built-in MaxMind GeoLite2 database. No external API calls, no data sent to third parties.
- Applies at checkout — Price adjustments modify the actual product price, so customers pay the adjusted amount throughout the cart and checkout.
- Role exemptions — Exempt logged-in users or specific roles so administrators and shop managers always see the real store.
- Bot-friendly — Search engine and ad-platform crawlers can be exempted from redirections so advertising campaign verification is not affected.
- Clean, modular code — Loads only the features you enable.
Features
Country-Based Redirections
Automatically redirect visitors to specific URLs based on their detected country. Useful for:
- Directing customers to regional stores
- Complying with local regulations (GDPR notices, age restrictions)
- Creating market-specific landing pages
Content Visibility Rules
Control what WooCommerce content visitors can see:
- Hide Prices — Remove price display for specific countries
- Hide Add-to-Cart — Prevent purchases while keeping products visible
- Target all products, specific categories, or individual products
Price Adjustments
Modify prices based on visitor location:
- Apply percentage increases or decreases
- Add or subtract fixed amounts
- Set entirely different prices per country
- Adjustments apply at checkout, not just on display
Testing & Developer Tools
- Test simulator on each rules screen to preview which rule would match
- “Force Country” developer tool to simulate visits from any country
Pro Features
The Pro version unlocks the full potential:
Payment & Shipping Restrictions (New in 1.2.0)
Control checkout options by country:
- Restrict payment methods (hide PayPal for certain countries, show local payment options)
- Restrict shipping methods (disable international shipping, show local carriers)
- Create country groups for easier management
Currency Conversion
Display prices in visitor’s local currency:
- Automatic exchange rates via European Central Bank
- 30+ currencies supported
- Manual rate override option
- Smart rounding rules
Content Shortcode
Display conditional content anywhere with [cbc_content]:
[cbc_content countries="FR,BE,CH"]
Free shipping to France, Belgium, and Switzerland!
[/cbc_content]
[cbc_content countries="US" match="exclude"]
International shipping rates apply.
[/cbc_content]
State/Region Targeting
Go beyond countries — target specific states or regions:
- US states (CA, TX, NY…)
- Canadian provinces (QC, ON, BC…)
- German Länder, Australian states, and more
- Use in shortcodes:
[cbc_content regions="US:CA,US:TX"]
Additional Pro Features
- Hide products completely from catalog and search
- Display alternative content (“Not available in your region”)
- Tax message display by country
- Priority support
How It Works
The plugin uses WooCommerce’s built-in MaxMind GeoLite2 geolocation database. This means:
- No external API calls — Detection happens locally on your server
- No data sent to third parties
- Fast and reliable — No dependency on external services
- 99%+ accuracy at the country level
Requirements
- WordPress 6.0 or higher
- WooCommerce 8.0 or higher
- PHP 7.4 or higher
- WooCommerce geolocation enabled (Settings General Default customer location)
Installation
- Upload the plugin files to
/wp-content/plugins/codefaeries-country-based-content/or install directly through the WordPress plugins screen - Activate the plugin through the ‘Plugins’ screen in WordPress
- Ensure WooCommerce is installed and activated
- Important: Enable WooCommerce geolocation:
- Go to WooCommerce Settings General
- Set “Default customer location” to “Geolocate” or “Geolocate (with page caching support)”
- Navigate to WooCommerce Country Content to configure the plugin
- Enable desired features in the “Features & Settings” tab
- Create your rules in the respective tabs
FAQ
-
How does country detection work?
-
The plugin uses WooCommerce’s built-in MaxMind GeoLite2 database. Detection happens locally on your server with no external API calls, making it fast, reliable, and privacy-friendly.
-
How accurate is the geolocation?
-
Country-level detection is typically 99%+ accurate. Users with VPNs or corporate proxies may be detected in a different location.
-
Does this affect actual checkout prices?
-
Yes. Price adjustment rules modify the actual product price, so customers pay the adjusted price at checkout. This ensures price consistency throughout the shopping experience.
-
Does this work with page caching?
-
Yes. The plugin is designed to work with page caching. For best results, use WooCommerce’s “Geolocate (with page caching support)” option.
-
Can I test rules without affecting real visitors?
-
Yes. Use the “Force Country” option in Developer Tools to simulate visits from any country. You can also use the Test Simulator on each rules page to preview which rules would apply.
-
What happens if a visitor uses a VPN?
-
The visitor will be detected based on their VPN exit location. Consider using the “Exempt logged-in users” option so registered customers always see accurate information.
-
Will redirections break my advertising campaigns?
-
No. The “Exempt bots and crawlers” option (enabled by default) prevents redirections for search engine and ad-platform crawlers, so campaign verification works as expected.
-
Is it privacy friendly?
-
Yes. The plugin only uses the IP address for local geolocation and does not store personal data or send anything to external services.
Reviews
There are no reviews for this plugin.
Contributors & Developers
“Codefaeries Country Based Content” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “Codefaeries Country Based Content” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
1.3.1
- Initial public release on WordPress.org
- Country-based redirection rules with bot and crawler exemption
- Content visibility rules (hide price, hide add-to-cart) targeting all products, categories or specific products
- Price adjustment rules (percentage, fixed amount, set price) applied at checkout
- User exemptions by role and for logged-in users
- Test simulator on every rules screen
- Developer tools to force a country for testing
