Geolocation IP Detection
Provides geographic information detected by an IP adress. This can be used in themes or other plugins, as a shortcode, or via CSS body classes. The city & country names are translated in different languages (supported languages). Features: You can use one of these data sources (see comparison): Free (default source): HostIP.info (IPv4 only) Free with registration: Maxmind GeoIP2 Lite City, automatically updated weekly Commercial: Maxmind GeoIP2 City or Maxmind GeoIP2 Country Commercial Web-API: Maxmind GeoIP2 Precision (City, Country or Insights) Hosting-Provider dependent: Cloudflare or Amazon AWS CloudFront (Country) Free or Commercial Web-API: Ipstack Commercial Web-API via AWS Marketplace: Fastah Provides these 5 functions (see API Documentation): geoip_detect2_get_info_from_ip($ip, $locales = array('en'), $options = array()): Lookup Geo-Information of the specified IP geoip_detect2_get_info_from_current_ip($locales = array('en'), $options = array()): Lookup Geo-Information of the current website user geoip_detect2_get_current_source_description(...): Return a human-readable label of the currently chosen source. geoip_detect2_get_external_ip_adress(): Fetch the internet adress of the webserver geoip_detect2_get_client_ip(): Get client IP (even if it is behind a reverse proxy) For the property names, see the results of a specific IP in the wordpress backend (under Tools > Geolocation IP Detection). You can include these properties into your posts and pages by using the shortcode [geoip_detect2 property="country.name" default="(country could not be detected)" lang="en"] (where ‘country.name’ can be one of the other property names as well, and ‘default’ and ‘lang’ are optional). You can show or hide content by using a shortcode [geoip_detect2_show_if country="FR, DE" not_city="Berlin"]TEXT[/geoip_detect2_show_if]. See Shortcode Documentation. When enabled on the options page, it adds CSS classes to the body tag such as geoip-province-HE, geoip-country-DE and geoip-continent-EU. If you are using a page cache, it is recommended to use the AJAX mode (see AJAX) When enabled on the options page, the client IP respects a reverse proxy of the server. If you are using Contact Form 7, you can use these shortcodes: A select input with all countries, the detected country being selected by default: [geoip_detect2_countries mycountry] A text input that is pre-filled with the detected city (or other property): [geoip_detect2_text_input city property:city lang:fr id:id class:class default:Paris] Geolocation information for the email text: [geoip_detect2_user_info] If you are using WP Forms, you can use this shortcode: Geolocation information for the email text: [geoip_detect2_user_info] Together with SVG Flags you can show the flag of the detected country: [geoip_detect2_current_flag] (see documentation) See Documentation for more info. How can I use these functions? You could choose the currency of the store based on the country name You could pre-fill the shipping country You could show the store nearest to your customer You show or hide content specific to a geographic target group Etc. … You tell me! I’m rather curious what you’ll do with this plugin! Be careful to comply to the applicable laws. For example Regulation (EU) 2018/302 … If you need to get the user’s timezone, it is more accurate to use JS solutions. System Requirements: You will need at least PHP 7.2.5 . Also, if you use the plugin WooCommerce, you’ll need at least WooCommerce 3.9.0 . GDPR: See Is this plugin GDPR-compliant? This extension is “charity-ware”. If you are happy with it, please leave a tip for the benefit of this charity. (See FAQ for more infos.) Here are other ways to contribute to the development of this plugin. This product can provide GeoLite2 data created by MaxMind, available from http://www.maxmind.com. Troubleshooting Does geoip_detect2_get_info_from_current_ip() return the same country, regardless of where you are visiting the site from? Maybe your server has a reverse proxy configured. You can check this: Go to the options page and look for “reverse proxy”. Are there 2 IPs listed there? If so, which one corresponds to your public IP? Or maybe you are using a site cache plugin. Then enable the option Disable caching a page that contains a shortcode or API call to geo-dependent functions. More Troubleshooting Hints
Top keywords
- detect214×1.97%
- geoip14×1.97%
- geoip detect214×1.97%
- country13×1.83%
- ip13×1.83%
- see9×1.26%
- city8×1.12%
- info7×0.98%
- maxmind6×0.84%
- shortcode6×0.84%
- show6×0.84%
- current5×0.70%
Country Based Restrictions for WooCommerce
Country Based Restrictions for WooCommerce lets you control exactly which products are visible and purchasable based on your customer’s country — using WooCommerce’s built-in geolocation engine (MaxMind GeoIP2) for 99.5% accuracy. Whether you’re selling region-specific products, dealing with legal compliance restrictions, or managing international distribution agreements, CBR gives you precise control over your catalog by country — without any coding. HPOS Compatible · 5,000+ Active Stores · Free & Open Source What You Can Do Restrict products per country — For any product, choose a list of countries to include (sell only to) or exclude (block from). Set it per product in seconds. Three visibility modes — Choose how restricted products behave for blocked customers: Hide completely from shop, search, and category pages Hide from shop and search but allow direct URL access Keep visible but non-purchasable (show with a custom message instead of Add to Cart) Include or exclude rules — For each product, choose whether the country list means “sell only to these countries” or “do not sell to these countries”. Works with WooCommerce Geolocation — Uses the shipping country the customer enters, falling back to WooCommerce Geolocation (MaxMind GeoIP2) when no shipping country is set yet. Supports product variations — Apply country restrictions to individual variations within a variable product, not just the whole product. HPOS Compatible — Fully compatible with WooCommerce High-Performance Order Storage (custom order tables). Translation ready — Fully translatable via standard WordPress/WooCommerce translation tools. How It Works Install and activate the plugin. Go to WooCommerce > Shipment Tracking > Country Restrictions to configure the default visibility settings. Open any product and set the country restriction rule — choose include or exclude, and select the countries. Customers visiting from a restricted country will see the product according to your chosen visibility mode. Free vs PRO — What’s the Difference? CBR Free gives you per-product country restrictions. CBR PRO adds bulk tools, payment gateway control, and advanced display options for stores managing restrictions at scale. CBR Free includes: Per-product country restriction rules (include or exclude) Three visibility modes: hide completely, hide from shop/search, or show but block purchase Variation-level restrictions WooCommerce Geolocation detection (MaxMind GeoIP2) HPOS compatible CBR PRO adds: Bulk restrictions by category, tag, attribute, or shipping class — Apply rules to entire product groups at once instead of editing each product individually. Global restriction rules — Apply one rule across all products sitewide. Bulk CSV import — Import country rules for hundreds of products at once. Disable payment gateways by country — Hide or disable specific payment methods (PayPal, Stripe, etc.) for customers from restricted countries. Hide product prices by country — Show the product but hide the price for restricted countries. Country detection widget — Let customers manually change their detected country from the storefront. Custom restriction messages — Set a custom message per product shown to restricted customers instead of the Add to Cart button. Redirect restricted customers — Redirect blocked visitors to a custom page instead of showing an error. Remove bulk rules — Clear single-product rules in bulk via the product list bulk actions. Priority support — Faster, dedicated assistance from the Zorem team. 👉 Get CBR PRO Compatible With CBR is tested and compatible with: Multilingual plugins — WPML, Polylang, Weglot Page builders — Elementor, Divi, WPBakery (Visual Composer) Wholesale plugins — Wholesale for WooCommerce Search plugins — Advanced Search for WooCommerce Subscriptions — WooCommerce Subscriptions (variation restriction supported) Multi-currency — Works alongside currency switcher plugins ⚠️ Important note for caching: Caching plugins (WP Rocket, W3 Total Cache, SiteGround Optimizer) and CDNs can serve cached pages that bypass geolocation detection. Ensure your caching is configured to exclude geolocation cookies and country detection from the cache. See the documentation for setup guidance. Documentation & Support 📖 Full documentation 💬 WordPress.org support forum More Plugins by Zorem Advanced Shipment Tracking for WooCommerce — The #1 WooCommerce shipment tracking plugin. Trusted by 80,000+ stores. SMS for WooCommerce — Automated SMS order and shipping notifications via Twilio, WhatsApp, and 18 other providers. Customer Email Verification PRO — Block fake accounts and spam orders with OTP-based email verification. Local Pickup PRO — Advanced local pickup with multiple locations, appointment scheduling, and ready-for-pickup notifications. Zorem Returns — Self-service returns, exchanges, and store credit management for WooCommerce. Explore the full catalog at zorem.com