Documentation
GeoBlock Pro
Geolocation

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

PrioritySourceNotes
1WooCommerce shipping addressUsed if customer is logged in with a saved address
2WooCommerce billing addressFallback if no shipping address
3WooCommerce sessionCached country from current session
4Session transientgeoblock_country transient (TTL: 3600 s)
5IP geolocationVia MaxMind GeoLite2 through WC_Geolocation::geolocate_ip()
6WooCommerce base countryStore'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:

  1. HTTP_CF_CONNECTING_IP (Cloudflare)
  2. HTTP_X_FORWARDED_FOR (first IP in chain)
  3. HTTP_X_REAL_IP (Nginx proxy)
  4. 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.