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 🙂
10 thoughts on “WooCommerce: How to Test Geolocation?”
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?
This would only populate the Country for logged out customers. The country doesn’t work at all?
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!
Yes, good point, thank you!
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.
Thanks for that Olof!
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?
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
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.
Excellent, and good luck with the transfer Steve 🙂