WooCommerce: How to Test Geolocation?

Great question, isn’t it?

How do you make sure your shipping, taxes and currency settings are working properly when they depend on geolocation and you can only test from a single world location?

WooCommerce uses a free geolocation service called MaxMind. By default this is active via the settings but can be disabled. The set of functions (or class) that WooCommerce uses is in the /includes folder, and it’s called Class WC_Geolocation.

Why WooCommerce Geolocation

If you have enabled “geolocation” in your WooCommerce settings (see image), shipping, taxes, currencies and conditional content will be chosen based on the user IP address.

WooCommerce snippets like this can print content on screen based on IP address. Also, plugins such as the currency switcher can automatically geolocate the user in order to function.

Geolocation Testing Tools

A couple of Google searches, and the answer is right there! There are at least 3 decent website services (freemium model) that allow you to test your website from different locations. As a result, you get a screenshot from each location.

These tools are:

Happy testing 🙂

 

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.

10 thoughts on “WooCommerce: How to Test Geolocation?

  1. I installed everything correctly and installed tools to run the WC_Integration_MaxMind_Geolocation->update_database() cron job but nothing is being populated into the checkout fields. Does it need time to run for the first update?

    1. This would only populate the Country for logged out customers. The country doesn’t work at all?

  2. Worth noting that due to changes at MaxMind you now have to setup integration rather than just let it do its thing. Thanks for the resources!

    1. Yes, good point, thank you!

  3. Since it is an IP-based system I prefer to use a VPS-service to visit the site from another location. This works very reliably – especially when using a private window for every test to prevent cached information and sessions.

    1. Thanks for that Olof!

  4. Hi Rodolfo,

    So if i turn on this geolocation thing in WP, will it auto change the currency for my visitors? or i need the aelia plugin like you mention in another post?

    how do i use your script to modify to redirect visitors based on their locations?

    thanks

    1. No, default Geolocation is to load shipping rates / checkout fields. For currency you need Aelia and for languages you need Polylang/WPML. Both plugins have autoredirect options. Hope this helps

  5. We appreciate the quick article Rodolfo. We are in process of migrating from Shopify to Woocommerce and this is one of our key features we rely on to display the right content for our customers. It’s great to see the website being tested simultaneously around the world.

    Thanks,
    Steve

    1. Excellent, and good luck with the transfer Steve 🙂

Questions? Feedback? Support? Leave your Comment Now!
_____

If you are writing code, please wrap it between shortcodes: [php]code_here[/php]. Failure to complying with this (as well as going off topic, not writing in English, etc.) will result in comment deletion. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining BloomerArmada to get blog comment reply priority, ask me 1-to-1 WooCommerce questions and enjoy many more perks. Thank you :)

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