[WordPress] 外掛分享: WindCodex GeoBlock – WooCommerce country restrictions with geolocation

首頁外掛目錄 › WindCodex GeoBlock – WooCommerce country restrictions with geolocation
WordPress 外掛 WindCodex GeoBlock – WooCommerce country restrictions with geolocation 的封面圖片
全新外掛
安裝啟用
尚無評分
10 天前
最後更新
問題解決
WordPress 5.8+ PHP 7.4+ v1.0.0 上架:2026-04-14

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.0.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「WindCodex GeoBlock – WooCommerce country restrictions with geolocation」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

Country Restrictions for WooCommerce lets you control exactly which products customers can see and buy based on their country – using WooCommerce’s built-in geolocation engine. No API key. No third-party service. No code required.
Whether you need to comply with regional laws, manage export restrictions, honour licensing agreements, or limit shipping destinations – this plugin gives you precise per-product country control in minutes.
Why store owners choose this plugin

No more failed deliveries – Stop customers from ordering products you can’t ship to their country.
Stay legally compliant – Block products restricted by local law (alcohol, supplements, age-restricted items, electronics).
Honour licensing agreements – Restrict digital or licensed products to territories your agreement covers.
Create country-specific catalogs – Show a tailored product selection to each market, automatically.
Reduce chargebacks – Prevent orders you’d only have to cancel and refund.

3 Restriction Modes – Choose how to handle each restricted product
Hide completely
Product is removed from shop pages, search results, and category listings for restricted visitors. Direct product URL returns a 404 page. Optionally redirect restricted visitors to a custom URL instead.
Hide from catalog, allow direct URL
Product is hidden from shop and search. The product page still loads via direct link – useful for distributors or partners in restricted regions. You can optionally allow full purchase via direct URL with a single toggle.
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. Perfect for explaining regional availability without making the product invisible.
Key Features

Per-product country rules – Set include or exclude rules on any product from the product edit screen. Searchable country selector with 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. Supports links, bold text, and any markup allowed by WordPress.
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, redirect 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 at cart and checkout, with a clear notice.
Server-side add-to-cart validation – Blocks direct POST, REST API, and AJAX add-to-cart attempts for restricted products. No client-side-only protection.
Smart country detection (6 layers) – Shipping address -> billing address -> WC session -> transient cache -> MaxMind GeoLite2 -> store base. No manual input needed from shoppers.
Cloudflare IP support – Reads CF-Connecting-IP automatically for sites behind Cloudflare.
Force Geolocation option – Ignore saved addresses and always detect country from IP.
Session & transient caching – Country detection results are cached per session for performance. Zero repeated geolocation lookups.
Debug toolbar – Admin-only bar at the bottom of every frontend page showing detected country, IP address, detection source, and a direct link to settings.
Shortcode support – [geoblock_product_message] renders the restriction message anywhere – page builders, custom templates, Elementor, Divi.
HPOS compatible – Fully compatible with WooCommerce High-Performance Order Storage.
Translation ready – Complete .pot file included. Fully translatable via Loco Translate or WPML String Translation.

Plugin Compatibility
Built-in compatibility layers 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 – Restriction on the bundle parent blocks the entire bundle from being purchased.
WooCommerce Subscriptions – Both subscription and variable-subscription product types are fully supported.
WP Rocket – Product pages automatically excluded from page cache so every visitor gets the correct restricted/unrestricted version.
Speed Optimizer by SiteGround – Product pages bypass SiteGround’s dynamic cache using SGCACHENOCACHE and sgo_bypass_cache.

Use Cases

Block alcohol or age-restricted products from countries where they’re prohibited
Restrict physical products to countries you can ship to
Limit digital downloads to licensed territories
Hide out-of-stock regional variants from other markets
Show a -contact us to order in your region- message instead of hiding the product
Create exclusive country-specific product catalogs

Shortcode
Display the restriction message anywhere using:
[geoblock_product_message]
Attributes:
* id – Product ID to check. Defaults to 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

Install and activate the plugin.
Go to WooCommerce > GeoBlock Restrictions and choose a restriction mode.
Open any product and find the GeoBlock – Country Restrictions meta box.
Select Include or Exclude, choose your countries, and save.
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: WooCommerce Settings > General > Default customer location > Geolocate

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.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon