plugin-icon

WindCodex GeoBlock – WooCommerce Country Restriction & Geo Blocking

لصاحبه WindCodex·
Block WooCommerce products by country. Hide products, restrict checkout, or show a custom message by geolocation – no API key required.
النسخة
1.0.2
آخر تحديث
Jul 29, 2026
WindCodex GeoBlock – WooCommerce Country Restriction & Geo Blocking

WindCodex GeoBlock lets you restrict WooCommerce products by country using WooCommerce’s built-in geolocation – no API key, no third-party service, no code required.

Whether you need to comply with local laws, honour export restrictions, manage licensing territories, or simply limit shipping to countries you serve – GeoBlock gives you per-product country control in minutes.

Why Store Owners Choose GeoBlock

  • Stop failed deliveries – Block customers from ordering products you cannot ship to their location.
  • Stay legally compliant – Restrict alcohol, supplements, age-restricted, or regulated products by region.
  • Honour licensing agreements – Limit digital downloads and licensed content to permitted territories.
  • Build country-specific catalogs – Show a tailored product range to each market automatically.
  • Reduce chargebacks – Prevent orders you would only have to cancel and refund anyway.

3 Restriction Modes

Hide Completely Product disappears from shop pages, search results, and category listings. The direct product URL returns a 404 page. Optionally redirect restricted visitors to any custom URL instead.

Hide from Catalog – Allow Direct URL Product is hidden from the shop and search but remains accessible via its direct link. Useful for distributors or B2B partners in restricted regions. A single toggle lets direct-URL visitors purchase too.

Show Restriction Message Product stays visible in the catalog. On the product page, the Add to Cart button and price are replaced with your custom HTML message – ideal for explaining regional availability without hiding the product entirely.

Key Features

  • Per-product country rules – Set include or exclude rules on any product from the product edit screen, with a searchable country selector and live rule summary.
  • Include or Exclude mode – Whitelist specific countries (only they can buy) or blacklist countries (everyone except them can buy).
  • Custom restriction message – Write your own HTML message with links, bold text, or any WordPress-allowed markup.
  • Configurable message position – Place the restriction notice above the title, below the title, after the description, or before product meta.
  • Redirect on restriction – In Hide mode, send restricted visitors to any URL instead of a 404 page.
  • Cart & checkout protection – Restricted products added to cart before a rule was applied are automatically removed, with a clear customer notice.
  • Server-side add-to-cart validation – Blocks direct POST, REST API, and AJAX add-to-cart attempts. Not just client-side.
  • Smart country detection (6 layers) – Shipping address billing address WC session transient cache MaxMind GeoLite2 store base country. No manual input needed.
  • Cloudflare IP support – Reads CF-Connecting-IP automatically for sites behind Cloudflare.
  • Force Geolocation option – Ignore saved addresses and always detect country from current IP.
  • Session & transient caching – Country detection results cached per session. Zero repeated geolocation lookups.
  • Admin debug toolbar – Shows detected country, IP address, detection source, and a settings link. Visible to admins only.
  • Shortcode support[geoblock_product_message] renders the restriction message in any page builder, custom template, Elementor, or Divi.
  • HPOS compatible – Fully supports WooCommerce High-Performance Order Storage.
  • Translation ready – Complete .pot file included. Compatible with Loco Translate and WPML String Translation.

Plugin Compatibility

Built-in compatibility for 6 popular plugins – no configuration needed:

  • Price Based on Country for WooCommerce – Restriction message takes priority over country-based pricing on restricted products.
  • WPML – Rules set on the original-language product automatically apply to all translated copies. No duplicate rules per language.
  • WooCommerce Product Bundles – Restricting the bundle parent blocks the entire bundle from purchase.
  • WooCommerce Subscriptions – Both subscription and variable-subscription product types fully supported.
  • WP Rocket – Product pages automatically excluded from page cache so every visitor gets the correct restricted or unrestricted version.
  • Speed Optimizer by SiteGround – Product pages bypass SiteGround’s dynamic cache via SGCACHENOCACHE and sgo_bypass_cache.

Use Cases

  • Block alcohol or age-restricted products from countries where they are prohibited by law
  • Restrict physical goods to only the countries you ship to
  • Limit digital downloads to licensed territories
  • Hide out-of-stock regional variants from international markets
  • Display a “contact us to order in your region” message instead of hiding the product
  • Build exclusive country-specific product catalogs for different markets

Shortcode

Display the restriction message anywhere on your site using: [geoblock_product_message]

Attributes: * id – Product ID to check. Defaults to the current product in the loop. * class – Extra CSS class(es) added to the message wrapper div.

Examples: [geoblock_product_message id=123] [geoblock_product_message id=123 class=”my-notice highlight”]

How It Works

  1. Install and activate the plugin.
  2. Go to WooCommerce > GeoBlock and choose a restriction mode.
  3. Open any product and find the GeoBlock – Country Restrictions meta box.
  4. Select Include or Exclude, choose your countries, and save.
  5. GeoBlock automatically detects each visitor’s country and applies your rules in real time.

Requirements

  • WordPress 5.8 or higher
  • WooCommerce 7.0 or higher
  • PHP 7.4 or higher
  • WooCommerce Geolocation must be enabled: WooCommerce Settings > General > Default customer location > Geolocate

🚀 Pro Version

Need bulk category rules, payment gateway restrictions by country, variation-level rules, or an analytics dashboard? GeoBlock Pro is available at windcodex.com

Privacy

GeoBlock uses the visitor’s IP address solely to determine their country. No personal data is stored permanently. Detection results are cached in WooCommerce session storage and WordPress transients with a 1-hour TTL. No data is sent to external servers. This plugin does not collect, sell, or share any visitor data.

مجانيعلى الخطط المدفوعة
إذا أتممت بالتثبيت، فإنك توافق على شروط خدمة ووردبريس.كوم ووشروط إضافات الأطراف الثالثة.
تم اختباره حتى
WordPress 7.0.3
تتوفّر هذه الإضافة للتنزيل لتُستخدم في عملية التثبيت لديك.