The geolocation feature used by the Aelia plugins is provided by the Aelia Foundation Classes framework, which is installed with them. The framework includes a debug mode, which can be enabled to log all the attempts to resolve a visitor's geolocation.
Please follow the steps below to enable and view the geolocation log.
1. Enable the debug mode in the Aelia settings
You can enable the debug mode by going to WooCommerce > Settings > Aelia > Support. Enable the "debug mode" option and save the settings. The page will also show you where you can find the log file generated by the Currency Switcher.
2. Test the geolocation
Using a VPN and an incognito/private browsing window, visit your site from several locations. This will add entries to the log file, showing the IP address and the resulting country and currency.
3. Review the debug log
You can find the log file at the location displayed at step #1. Since WooCommerce 3.x, you can also view the log file by going to WooCommerce > Status > Logs. Below you can find a sample log, which shows the IP addresses received by the geolocation logic in the following headers:
The geolocation looks for an IP address in each of those headers, in the order specified above. The first header containing a valid IP address is taken as visitor's IP address, and used to determine information such as customer's location and currency.
Possible issues you might encounter
- If you see the same IP address for different visitors, then it means that your site is behind a reverse proxy that masks your visitors' real IP addresses. In such case, you can contact your hosting provider to get the real IP address passed to your site.
- Some hosting providers (e.g. Bluehost) mix up the headers. For example, they can pass visitor's IP address in the REMOTE_ADDR header and their own server's address in the HTTP_X_FORWARDED_FOR header. This is incorrect, as the latter, when present, must be the visitor's IP address.
If you encounter this issue, we recommend to contact your hosting provider and ask them to correct the server settings, so that visitor's IP address is passed in the right header.
4. Disable the debug mode at the end of the troubleshooting
The geolocation log can grow quickly, if you receive a large amount of traffic. Due to that, we strongly recommend to disable the debug mode after collecting the necessary amount of data to test the geolocation and determined the possible cause of issues.
You can disable the debug mode by going to WooCommerce > Settings > Aelia > Support. On that page, uncheck the "debug mode" option and save the settings.