WooCommerce Geolocation Not Working? Fix the Four Common Causes

TL;DR

  • Wrong currency for some visitors? It is almost always page caching, not geolocation.
  • “Unable to download the GeoIP database: forbidden”? Your MaxMind licence key is missing or wrong.
  • Fatal error traversing the database? Two plugins are loading the same GeoIP library twice.
  • Subscriptions renewing in the wrong currency? Geolocation should never decide a renewal. Lock it to the original order.

WooCommerce geolocation looks like a single checkbox. In practice it is a chain of four things that each fail in their own way, and when one link breaks the symptom the customer reports is almost never the thing that is actually wrong. A shopper in Leeds sees euros. A renewal charges in the wrong currency. A fatal error appears in the log at three in the morning and nobody can reproduce it.

This guide covers the four WooCommerce geolocation failures Diego sees most often in support, what causes each one, and how to fix it. It applies whether you use core WooCommerce geolocation on its own or alongside the Aelia Currency Switcher for WooCommerce.

How WooCommerce Geolocation Actually Works

How WooCommerce geolocation resolves a visitor IP address through a GeoIP database to a country and currency

Four steps, in order. Knowing which step you are debugging saves most of the time.

The WooCommerce Geolocation Chain

  1. Read the IP address. WooCommerce takes the visitor’s IP from the request. Behind a proxy or CDN this is where it can already go wrong.
  2. Look it up. The IP is checked against a local MaxMind GeoLite2 database file, which WooCommerce downloads and stores on your server.
  3. Resolve a country. The lookup returns a two-letter country code, and nothing more precise than that.
  4. Map the country to something useful. A currency, a tax rate, a shipping zone, a restricted region. This is the step your customer actually sees.

Two things follow from this that are worth saying plainly. Geolocation gives you a country, not a currency preference, so the mapping in step four is a business decision you make rather than something the database tells you. And every step happens server-side while the page is being built, which is exactly why caching is the most common cause of trouble.

Why WooCommerce Geolocation Shows the Wrong Currency

Two different visitors receiving the same cached WooCommerce page, showing why geolocation and page caching conflict

This is the number one report, and the cause is almost never the GeoIP database. It is page caching.

A full-page cache stores the finished HTML of a page and serves that same copy to the next visitor. Geolocation decides the currency while the page is being built. So the first visitor after a cache purge decides what everyone else sees until the cache expires. If that visitor was in Berlin, your Leeds customer gets euros, and no amount of checking the MaxMind settings will explain it.

How to Confirm It Is Caching in Two Minutes

Load a product page in a private window, note the currency, then load the same URL with a random query string appended, for example ?cb=12345. A query string usually bypasses the cache. If the currency is correct with the cache-buster and wrong without it, you have a caching problem and the geolocation is working perfectly.

The fix is not to disable caching, because that trades a currency bug for a speed problem. The fix is to make the cache aware of the currency so that each currency gets its own cached copy of the page. That is what the WooCommerce Cache Handler does, free of charge, for static caching systems including Cloudflare, SiteGround, WP Engine, Flywheel and W3 Total Cache. Without something doing that job, geolocation and caching will keep contradicting each other.

Three related causes worth ruling out while you are in there. A CDN in front of the site may strip or rewrite the visitor IP, so WooCommerce sees the CDN’s address rather than the customer’s. Corporate VPNs place people in the wrong country legitimately, which is not a bug. And a shopper’s manual currency choice must persist across pages; if it resets on navigation, the session is being lost rather than the geolocation failing.

Fixing “Unable to Download the GeoIP Database: Forbidden”

This notice means WooCommerce asked MaxMind for the GeoLite2 database file and MaxMind refused. It is an authentication failure, not a network fault, and it has been common since MaxMind began requiring a licence key for downloads.

Step 1: Create a MaxMind Account

Sign up for a free GeoLite2 account with MaxMind. The free tier is sufficient for country-level lookups, which is all WooCommerce needs.

Step 2: Generate a Licence Key

In your MaxMind account, create a new licence key. Copy it immediately, because it is shown once.

Step 3: Add the Key to WooCommerce

Go to WooCommerce, then Settings, then Integration, then MaxMind Geolocation, and paste the key. Save.

Step 4: Check the File Landed

WooCommerce stores the database under wp-content/uploads/. If the folder is not writable, the download will fail even with a valid key, so confirm the file exists and has a recent timestamp.

If the notice persists after all four steps, the usual culprits are a firewall blocking outbound requests from your server, or a host that disallows remote file downloads. Both are questions for your host rather than for WooCommerce.

Fixing GeoIP Fatal Errors When Two Plugins Clash

Two WooCommerce plugins loading the same GeoIP library twice and causing a crash

A fatal error mentioning the GeoIP or MaxMind library, appearing intermittently and impossible to reproduce on demand, usually has one cause: two plugins are loading the same library, and PHP will not allow the same class to be declared twice.

Geo-blocking and geo-redirect plugins ship their own copy of the MaxMind library, and so does the Aelia Currency Switcher. The Currency Switcher has detected this condition since version 2.3.5.131016 and will stand aside if the library is already present, but that only helps if it loads after the other plugin. If the Currency Switcher loads first, the other plugin tries to load the library again and throws the error.

PluginStatus with the Currency SwitcherWhat to do
Geo RedirectCompatible, load order mattersEnsure Geo Redirect loads first. The root fix belongs in Geo Redirect, which should check whether the library is loaded before loading it
iQ Block CountryCompatible from version 1.1.14Update iQ Block Country to 1.1.14 or later and the clash goes away
Any other geo pluginTest explicitlyDeactivate it, confirm the error stops, then reintroduce it and check load order

Plugin load order follows the order plugins were activated, which is why this bug often appears after an unrelated update or a site migration rather than on the day you installed anything. If you run a geo-blocking plugin alongside a currency plugin, test that specific combination on staging before every release.

Geolocation Rules for WooCommerce Subscriptions

Flow diagram: detect the customer country, then resolve currency, then resolve tax, then present the checkout

Here is the rule that prevents the most expensive version of this problem: geolocation should decide the currency for a new visitor, and never for a renewal.

A renewal is processed by a scheduled task, not by a browser. There is no visitor, no IP address and no country to detect. If the renewal logic falls back to geolocation, or to whatever the store’s default currency happens to be, a customer who signed up in euros can be charged in pounds three months later. They notice, they ask for a refund, and your accounts now carry a currency mismatch against the original order.

The currency must come from the original subscription record. For the Aelia Currency Switcher that is handled by the free Subscriptions Integration add-on, which requires Currency Switcher 3.3.11.140619 or later. Note that with Subscriptions 2.x an update may be needed so that renewals and re-subscriptions resolve the right currency. Test one real renewal on staging before launch, because this failure surfaces a month after go-live rather than on day one. The same principle applies to bookings, which are covered in our WooCommerce checkout localisation checklist.

WooCommerce Geolocation Troubleshooting Checklist

SymptomMost likely causeFix
Some visitors see the wrong currencyFull-page cachingPer-currency cache variants, via the Cache Handler
Everyone sees the same wrong countryCDN or proxy masking the visitor IPConfigure the real client IP header with your host
“Unable to download the GeoIP database: forbidden”Missing or invalid MaxMind licence keyGenerate a key and add it under Settings, Integration
Database never updateswp-content/uploads/ not writableCorrect the directory permissions
Intermittent fatal error naming GeoIP or MaxMindTwo plugins loading the same libraryUpdate or reorder the geo plugin
Renewal charged in the wrong currencyRenewal falling back to geolocation or the defaultRead the currency from the original subscription
Currency resets when moving between pagesSession not persistingCheck session handling and object caching
Currency right on the product page, wrong at checkoutCheckout page cached separately, or a conflicting pluginExclude checkout from caching and audit for a second currency plugin

One more, because it accounts for a surprising share of tickets: two plugins both trying to own the currency. If a currency switcher and a separate price-by-country plugin are both active, they will fight over the same product price and produce intermittent wrong totals with no pattern. Currency belongs to exactly one plugin on any store.

Frequently Asked Questions About WooCommerce Geolocation

How Do I Enable Geolocation in WooCommerce?

Go to WooCommerce, then Settings, then General, and set “Default customer location” to “Geolocate”. If you use full-page caching, choose “Geolocate (with page caching support)” instead, which appends a country code to URLs so cached copies stay separated. You also need a MaxMind licence key under Settings, then Integration, or the lookup database will never download.

Why Is WooCommerce Geolocation Not Working?

In order of likelihood: page caching is serving one visitor’s version to everyone; the MaxMind licence key is missing so the database was never downloaded; a CDN or reverse proxy is masking the visitor IP; or a second plugin is also setting the currency. Test with a cache-busting query string first, because that single check rules in or out the most common cause.

Does WooCommerce Geolocation Need MaxMind?

Yes. Core WooCommerce geolocation uses the MaxMind GeoLite2 country database, and MaxMind requires a free account and a licence key before it will serve the download. Without the key you will see a “forbidden” notice and geolocation will silently do nothing.

Can I Use Geolocation With Page Caching?

Yes, but only if the cache is aware of the currency or country, so that each variant is stored separately. WooCommerce offers a caching-friendly geolocation mode, and for multi-currency stores the free WooCommerce Cache Handler adds per-currency cache variants for static caching systems including Cloudflare, WP Engine and W3 Total Cache. Without one of these, caching and geolocation will contradict each other.

How Accurate Is WooCommerce Geolocation?

Reliable at country level for most residential connections, and that is all WooCommerce asks of it. It will be wrong for VPN users, some mobile networks and corporate connections that route through another country. Treat the detected country as a sensible default the shopper can always override, never as a fact you enforce.

Why Did My Subscription Renew in the Wrong Currency?

Because the renewal did not read the currency from the original order. Renewals run as scheduled tasks with no visitor and no IP address, so if the logic falls back to geolocation or the store default it will pick the wrong currency. With the Aelia Currency Switcher, install the free Subscriptions Integration add-on, which requires Currency Switcher 3.3.11.140619 or later, and test a real renewal on staging.

Get Geolocation and Currency Working Together

Most geolocation problems are really currency problems wearing a disguise, and they are cheaper to prevent than to debug after launch. If you are running multi-currency on a cached store, the combination is what needs testing, not either part on its own.

Aelia Currency Switcher for WooCommerce

£89.00 ex. VAT, annual, single site. Geolocation-aware currency selection, a free cache handler for static caching systems, a single-site licence, a year of updates, direct support from the team that builds the plugin, a 14-day free trial and a 30-day money-back guarantee.

View the Aelia Currency Switcher

Keep Reading on WooCommerce Geolocation and Currency

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.