Country Product Block — Smart Geo-Targeting for Your MarketplaceControl Product Visibility by Customer Location with Automatic IP Detection
Show the right products to the right customers. Country Product Block uses advanced IP geolocation to automatically detect visitor location and display only products available in their country. Perfect for international marketplaces with region-specific inventory.
Version: 1.0.0
Author: Maryam International LLC (www.codeupp.xyz)
Compatibility: Botble CMS 7.3+, All Themes
Requires: Ecommerce Plugin
How Location Detection Works
The plugin uses multiple detection methods with automatic fallback:
1. IP Geolocation (Primary Method)
2. Detection Flow
1. Check CloudFlare header (HTTP_CF_IPCOUNTRY) → Instant 2. Check MaxMind GeoIP2 database (local) → Fast 3. Fallback to IP-API.com (free API) → Reliable 4. Cache result for 24 hours per IP → Performance
3. Admin Override
Key Features
FeatureDescription
Auto Country Detection
Detects visitor country from IP address automatically
Multi-Provider Fallback
CloudFlare → MaxMind → IP-API with smart caching
Admin Toggle
Enable/disable country filtering globally with one click
Dynamic Country List
Uses active countries from your theme/ecommerce settings
Vendor Control
Sellers assign countries to their own products
Admin Control
Admin assigns countries to inhouse products
Bulk Assignment
Assign multiple products to countries at once
Homepage Filtering
Only shows products available in visitor's country
Category Filtering
Category pages respect country restrictions
Search Filtering
Search results filtered by country
Performance Optimized
IP results cached, minimal database queries
Testing Mode
Admin can test different countries without VPN
How It WorksFor Customers (Automatic)
For Admin
For Vendors/Sellers
InstallationStep 1: Upload Plugin
Copy the country-product-block folder to:
platform/plugins/country-product-block
Step 2: Install Dependencies
Run in your project root:
composer require geoip2/geoip2
Step 3: Activate Plugin
Step 4: Download GeoIP Database (Optional but Recommended)
For offline IP detection (faster and more reliable):
Without GeoIP database: Plugin uses free IP-API.com (works fine, requires internet)
Admin PanelSettings Page
Admin → Country Product Block → Settings
Product Assignment
Admin → Products → Edit Product
New section: "Available Countries"
Bulk Assignment
Admin → Country Product Block → Bulk Assign
Vendor PanelProduct Assignment
Vendor Dashboard → Products → Edit Product
New section: "Available Countries"
Technical DetailsDatabase Tables
cpb_product_countries
cpb_settings
IP Detection Cache
Hooks & Filters
The plugin hooks into:
Detection Methods Explained1. CloudFlare Header (Fastest)
If your site uses CloudFlare CDN:
2. MaxMind GeoIP2 (Most Reliable)
If you upload the GeoLite2 database:
3. IP-API.com (Free Fallback)
If CloudFlare and MaxMind unavailable:
4. Default Behavior
If all methods fail:
Use CasesInternational Marketplace
Region-Specific Inventory
Compliance & Restrictions
Multi-Vendor Regional Control
Testing Without VPN
Admin Panel → Country Product Block → Settings → Test Country
Session-based: Only affects your admin session, not other visitors.
Performance Optimization
FAQ
Q: What happens if I don't assign countries to a product?
A: Product is visible everywhere (default behavior).
Q: What if customer uses VPN?
A: Plugin detects VPN exit node country. Customer sees products for that country.
Q: Does this work with marketplace plugin?
A: Yes! Both admin and vendors can assign countries to their products.
Q: What if IP detection fails?
A: Plugin shows all products (no filtering). Site continues working normally.
Q: Can I test without VPN?
A: Yes! Use the "Test Country" feature in admin settings.
Q: Does this slow down my site?
A: No. IP detection is cached for 24 hours. First visit = 1 API call, then cached.
Q: Do I need MaxMind database?
A: No, but recommended. Plugin works fine with free IP-API.com fallback.
Changelogv1.0.0 — March 2026
Initial Release:
Support
For support, customization, or feature requests:
Show the right products to the right customers, automatically.
Country Product Block — Smart geo-targeting for modern marketplaces.
Developed with precision by Maryam International LLC — Powering marketplaces worldwide.
Have doubt? Contact us on WhatsApp
Our product is high quality. Contact us for any kind of custom work.