FOX - Currency Switcher Professional for WooCommerce

Using Geolocation causes problems, doesn’t seem to work for me

Attention: from WooCommerce v.3.9 for geolocation functionality maxmind key required in woocommerce settings: wp-admin/admin.php?page=wc-settings&tab=integration&section=maxmind_geolocation

Try to change geo location rules and look them in different browsers, because the same browser will show you only first result. Even better send link to the friends, because if data storage selected as transient (also memcached or redis) you will see the same result in all browsers in your computer (the same IP) – another computer necessary – share link with friends.


You are in Spain, and want to check GeoLocation, so add JPY for example, save, go to Geo rules and for JPY set Spain 

Open Opera browser for example, I mean any another browser you not used for testing your site else and you will see that JPY is set! Do not do the same test in the same browser already, today exactly….

GeoLocation provided by native woocommerce native API, so it should works perfectly … Any way WOOCS uses woocommerce functionality. Sometimes happens that in the places near border geo ip shows another country, for example in Spain in city Logroño shows that its in France.


From version 2.1.8/1.1.8 its possible use for testing this shortcode: [woocs_geo_hello] – drop it usual text-widget or any page to see info about state of GeoIp functionality on your site.

Also you can try next –  insert code below in your current wp theme file functions.php:

    return true;

If you using any cache plugins enable: WooCommerce settings -> General -> Default customer location

If you using rocket cache plugin disable option ‘Enable caching for logged-in WordPress users‘:

For testing GeoIP functionality you can use next service:

ATTENTION: If you sure that recommendations above done right – check is woo geo functionality works at all on your site:

  • open header.php of current wp theme
  • drop there next script on the same bottom of the file:
    $pd = WC_Geolocation::geolocate_ip(); print_r($pd);
  • save the file
  • update front of the site and and find printed array (CTRL+U then CTRL+F search ‘Array‘)
  • if that array is empty – woo geo functionality doesn work on your site/server
  • You can find some recommendations here

Another example of an issue:

The matter was just solved today. I would like to share with you how it was solved after reaching out to my provider and WC, just in case a client having the same provider comes forward with the same issue.

So my provider is Bluehost. It seems that only recently they started to populate HTTP_X_FOWARDED_FOR with my server’s static IP. Maybe this happened after some update they did, i don’t know. They weren’t really helpful in providing info regarding all this. WooCommerce were the ones who were able to detect the problem after some time and suggested a solution/ work around.
WooCommerce will generally check the following variables for the real IP (starting from the top):

So WooCommerce is looking up the country for this IP address instead of the IP address that is stored in REMOTE_ADDR.

WooCommerce expects the HTTP_X_FORWARDED_FOR to be in the following format:

Proxy servers can send through this header like this: X-Forwarded-For: client1, proxy1, proxy2
Make sure we always only send through the first IP in the list which should always be the client IP.

WooCommerce suggested a work around which would involve a snippet to be added to functions.php to override it:

if ( isset( $_SERVER['REMOTE_ADDR'] ) && ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {

After adding the snippet to functions.php all worked well and was finally able to activate currency switcher again 🙂

Note: also, found out hostgator had a similar issue as well


Notes for WP Rocket: FOX doesn’t work while WP Rocket is active