GeoShield – Country Restrictions Lite for WooCommerce

Description

GeoShield Lite is a geolocation-based product restriction plugin for WooCommerce. It gives store owners control over which products are visible or purchasable based on a visitor’s country.

This is useful for stores that need to comply with international licensing agreements, regional distribution contracts, or country-specific product availability rules.

How It Works

GeoShield Lite primarily uses the built-in WooCommerce geolocation system (MaxMind GeoIP database) to detect a visitor’s country. To ensure a seamless “out-of-the-box” experience for stores without a MaxMind configuration, the plugin includes a fail-safe fallback to a legitimate third-party geolocation service. Based on per-product restriction rules you configure, the plugin can either hide products entirely or disable the purchase button for visitors from specified countries.

All restriction logic runs locally using WordPress metadata — external API calls are used strictly as a fallback for country identification when local detection is unavailable.

Features

  • Per-Product Restrictions — Define unique country restriction rules directly within the WooCommerce product editor.
  • Variation-Level Overrides — Apply independent geographic rules to specific product variations.
  • Blacklist and Whitelist Modes — Block selected countries (blacklist) or allow only selected countries (whitelist).
  • Two Restriction Actions — Hide the product completely from the catalog, or keep it visible but disable the purchase button.
  • Custom Restriction Messages — Display a configurable message to visitors who are restricted from purchasing.
  • Automatic Catalog Filtering — Restricted products are automatically filtered from the shop page, category pages, search results, and related product sections.
  • WooCommerce Blocks Compatibility — Works with both classic and block-based Cart and Checkout pages.
  • HPOS Compatible — Fully compatible with WooCommerce High-Performance Order Storage.

Configuration

After activation, configure restrictions on individual products:

  1. Edit any WooCommerce product.
  2. Open the Country Restrictions tab in the Product Data panel.
  3. Enable restrictions and select your target countries.
  4. Choose between Hide Product or Disable Purchase.
  5. Save the product.

Global settings are available under the GeoShield > Settings menu.

External Services

GeoShield Lite uses external services to detect visitor locations for restriction purposes. Below is complete documentation of all external services used, what data is transmitted, and when.

IP Address Detection Service (ipify)

What it does: Detects your server’s public IP address to enable accurate geolocation when your server is behind a proxy, load balancer, or CDN.

When it’s used: Only when the plugin needs to determine the server’s external IP address for geolocation purposes. This typically happens once during initial setup or when geolocation cache expires.

What data is sent: A standard HTTP request to api.ipify.org. No user data, no store data, no personal information is transmitted. Only your server’s IP address is detected (which is already visible to any website you connect to).

Service provider: ipify API
Website: https://www.ipify.org
Terms of Service: https://www.ipify.org
Privacy Policy: https://www.ipify.org (ipify does not log or store IP addresses)

Geolocation Service (IP-API)

What it does: Converts IP addresses to geographic locations (country and state/region) to enforce your restriction rules.

When it’s used: As a fallback when WooCommerce’s built-in geolocation is unavailable. Only activates if you haven’t configured MaxMind GeoIP in WooCommerce settings.

What data is sent: The visitor’s IP address is sent to ip-api.com to determine their country and state/region. No other personal information is transmitted.

Service provider: IP-API
Website: https://ip-api.com
Terms of Service: https://ip-api.com/docs/legal
Privacy Policy: https://ip-api.com/docs/legal

Note: You can avoid using this fallback service by configuring MaxMind GeoIP in WooCommerce Settings Integration. When MaxMind is configured, GeoShield uses WooCommerce’s native geolocation exclusively.

Data Privacy & GDPR Compliance

GeoShield is designed with privacy in mind:

  • Only IP addresses are transmitted to external services (no names, emails, or personal data)
  • IP addresses are processed solely for geolocation purposes
  • No data is stored by external services (per their privacy policies)
  • All external calls use secure HTTPS connections
  • You can use WooCommerce’s built-in MaxMind integration to eliminate fallback external calls entirely

If you have privacy concerns, we recommend configuring MaxMind GeoIP in WooCommerce settings to keep all geolocation processing local to your server.

Screenshots

  • Dashboard — Overview of your store’s geographic restriction status.
  • Global Settings — Configure global restriction behavior and messages.
  • Product Settings — The Country Restrictions tab within the product editor.
  • Frontend Notice — Restriction message displayed to visitors from restricted regions.

Installation

  1. Upload the geoshield-country-restrictions-lite directory to /wp-content/plugins/.
  2. Activate the plugin through the Plugins menu in WordPress.
  3. Go to WooCommerce > Settings > General and set Default Customer Location to “Geolocate”.
  4. Edit any product and use the Country Restrictions tab to set up restrictions.

FAQ

How does the plugin detect a visitor’s country?

GeoShield Lite uses the WooCommerce geolocation system, which determines a visitor’s approximate location based on their IP address using the MaxMind GeoIP database.

Can I restrict individual product variations?

Yes. Each variation can have its own independent restriction rules, separate from the parent product.

What happens when a product is hidden?

When set to “Hide Product”, the product is removed from the shop catalog, search results, and category pages. Direct URL access returns a 404 page by default, though you can configure it to redirect to the shop page instead.

What happens when purchase is disabled?

When set to “Disable Purchase”, the product remains visible in the catalog and on its single product page, but the Add to Cart button is disabled and a restriction message is displayed.

Does this work with caching plugins?

Yes. The plugin follows WooCommerce geolocation best practices, which includes compatibility with popular caching solutions.

Does this hide products from search engines?

Search engine crawlers are typically geolocated to a specific region. Products will remain crawlable unless you explicitly restrict them for that region.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“GeoShield – Country Restrictions Lite for WooCommerce” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.0.0

  • Initial release.
  • Product and variation level country restriction support.
  • Blacklist and whitelist mode support.
  • Hide and disable purchase restriction actions.
  • WooCommerce StoreAPI and HPOS compatibility.