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.

Continue reading WooCommerce: How to Test Geolocation?

WooCommerce: Detecting Current User Country (Geolocation)

In the redesign of Business Bloomer homepage, launched recently, I wanted to add some “personalization” to the main headline. In detail, I wanted to make use of PHP and WooCommerce inbuilt MaxMind Geolocation (when enabled from the General Settings Tab of course) to print a custom greeting on the screen.

The detection of the current user country could be very useful for other tasks, such as disabling payment gateways and shipping methods, printing country-specific content and so on. And as usual, this “detection” is done with one line of code! Continue reading WooCommerce: Detecting Current User Country (Geolocation)