| 开发者 |
dhimahisolutions
windcodex |
|---|---|
| 更新时间 | 2026年4月20日 13:28 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 6.9 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
CF-Connecting-IP automatically for sites behind Cloudflare.[geoblock_product_message] renders the restriction message anywhere - page builders, custom templates, Elementor, Divi..pot file included. Fully translatable via Loco Translate or WPML String Translation.subscription and variable-subscription product types are fully supported.SGCACHENOCACHE and sgo_bypass_cache.[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]windcodex-geoblock folder to /wp-content/plugins/.No. This plugin uses WooCommerce's built-in geolocation engine (MaxMind GeoLite2), which is already included with WooCommerce. No external API key, account, or paid service is required.
All countries supported by WooCommerce - the same full country list used in WooCommerce shipping and tax settings. You can restrict any single country or any combination of countries on each product.
Yes. Set WooCommerce's -Default customer location- to Geolocate (with page caching support) (AJAX mode). Country detection happens via AJAX after page load, so it works correctly even on fully cached pages. GeoBlock also includes a built-in WP Rocket compatibility layer that excludes product pages from cache.
GeoBlock shows a warning banner in the plugin settings page. Without geolocation, guest visitors fall back to the store's base country and restrictions will not apply to them. Logged-in customers with a saved shipping or billing address are still detected correctly.
Yes. Country rules are set at the parent product level and automatically apply to all variations. In Hide and Catalog Only modes, the entire product including all variations is restricted. In Message mode, the variation dropdowns and Add to Cart button are both hidden on the product page.
GeoBlock detects country based on IP address. A customer using a VPN may appear to be in a different country. For stores where VPN circumvention is a concern, we recommend enabling the -Force Geolocation- option which ignores saved addresses and always uses current IP detection.
GeoBlock automatically removes restricted products from the cart when the customer visits the cart or checkout page, and displays a clear notice explaining why. Checkout is also blocked as a final safety net even if the cart page was skipped.
Yes. Each product has its own independent set of rules. You can have Product A restricted to only Europe, Product B excluded from one country, and Product C with no restrictions at all - all at the same time.
No. Country restrictions are applied at the application level for logged-in users and detected visitors. Search engine crawlers are not affected and your products continue to be indexed normally. Country-based restrictions are a standard and accepted practice in international e-commerce.
Yes. GeoBlock processes IP addresses only to determine the visitor's geographic country for restriction purposes - a legitimate interest under e-commerce operation. No personal data is stored beyond the session/transient TTL (1 hour). No data is shared with third parties. Review and update your own privacy policy to document your use of geolocation.
Yes. GeoBlock's compatibility layer hooks into WooCommerce Subscriptions' own purchasability filters, fully supporting both subscription and variable-subscription product types.
Yes. Use the [geoblock_product_message id=PRODUCT_ID] shortcode in any page builder element or custom template to display the restriction message anywhere on your site.
Enable Debug Mode in WooCommerce GeoBlock Restrictions Advanced. A debug toolbar will appear at the bottom of every frontend page (visible to admins only) showing the detected country, IP address, and detection method. You can also temporarily change the restriction rule to include your own country to verify the hide/message behaviour.
In Hide completely mode, the direct product URL returns a 404 page. You can optionally configure a redirect URL to send restricted visitors to a custom page (like a contact or coming-soon page) instead of a 404.
CF-Connecting-IP header support for reverse-proxied sites.woocommerce_add_to_cart_validation blocks API/AJAX bypass attempts.[geoblock_product_message] shortcode for page builder and custom template compatibility..pot file included.