Geolocation
GeoBlock Pro uses the same six-priority detection cascade as the free version, powered by WooCommerce's built-in WC_Geolocation class and the MaxMind GeoLite2 database.
Detection Priority
| Priority | Source | Notes |
|---|---|---|
| 1 | WooCommerce shipping address | Used if customer is logged in with a saved address |
| 2 | WooCommerce billing address | Fallback if no shipping address |
| 3 | WooCommerce session | Cached country from current session |
| 4 | Session transient | geoblock_country transient (TTL: 3600 s) |
| 5 | IP geolocation | Via MaxMind GeoLite2 through WC_Geolocation::geolocate_ip() |
| 6 | WooCommerce base country | Store's configured base country as last resort |
Proxy & CDN Handling
GeoBlock reads the following headers in order to detect the real visitor IP when behind a proxy or CDN:
HTTP_CF_CONNECTING_IP(Cloudflare)HTTP_X_FORWARDED_FOR(first IP in chain)HTTP_X_REAL_IP(Nginx proxy)REMOTE_ADDR(direct connection)
Result Caching
The resolved country is stored in a transient keyed geoblock_country_{ip_hash} with a 1-hour TTL, eliminating repeated MaxMind lookups within the same session.
To bypass caching for testing or VPN-heavy audiences, enable Force Geolocation under Advanced Options.
⚠️
Keep WooCommerce's MaxMind GeoLite2 database up to date (WooCommerce → Settings → Integration → MaxMind Geolocation). GeoBlock Pro's accuracy depends entirely on this database.