Hi,
I reviewed your site, and I checked that PBoC is working because when I changed the country to ES (Spain) by adding the parameter wcpbc-manual-country=ES to the URL, the price and currency changed.
It seems a problem relate to how your hosting is providing the user IP. Could you review the Geolocation debug info of your WooCommerce system report? (the Geolocation debug info only is display if PBoC is active)
The IP of the first variable that appears must match the real IP (the last value).
Hi Oscar,
Thanks for your response. Geolocation dubug info:
HTTP_CF_IPCOUNTRY: X
GEOIP_COUNTRY_CODE: X
HTTP_X_COUNTRY_CODE: X
HTTP_X_REAL_IP: X
HTTP_X_FORWARDED_FOR: 192.185.20.98
REMOTE_ADDR: 183.82.16.81
Real external IP: 183.82.16.81
The WooCommerce geolocation function is always returning the United States as customer country because your server variable HTTP_X_FORWARDED_FOR does not contains the real user’s IP.
HTTP_X_FORWARDED_FOR: 192.185.20.98
REMOTE_ADDR: 183.82.16.81, This IP matchs with your real external IP (183.82.16.81)
To solve it you have 3 options:
+ Contact your hosting support to solve the issue.
+ Add Cloudflare to your site. Cloudflare includes geolocation and it’s free.
+ Add the following code to your config.php before the text /* That’s all, stop editing! Happy blogging. */:
$_SERVER['HTTP_X_FORWARDED_FOR'] = $_SERVER['REMOTE_ADDR'];
I hope this helps you.
Thank you so much Oscar!
I didn’t even have to try the first two options. The third one did the trick.
Thanks again!
Hi I’m having the same issue with my website http://www.ajali.com.ng
It was working perfectly up until 2 days ago and now all my prices are being displayed in the default currency USD. I’ve contacted my hosting platform and they are telling me there’s no IP address issues, is there anyway you can help.
Here’s a link to the debug info from my plugin
View post on imgur.com