Hi! We have currency plugin that works with your Woocommerce Geolocation (site: mylino.eu). After we installed Cloudflare, Geolocation not working right. I’m living in Estonia, but it shows me that Im from Sweden or sometimes from Russia (I can see it in checkout page shipping country) and currency changes to RUB or Sweden KR.
Do you know how the currency plugin determines geolocation? If it uses visitor IP address and the server has not been properly configured to work with Cloudflare, it may get incorrect IP address information.
https://support.cloudflare.com/hc/en-us/articles/200170786-Restoring-original-visitor-IPs
Its using shipping country for needed currency. In Woocommerce settings I set “Default Contry Location” to “Geolocate” (Its using MaxMind standart Woocommerce integration). So when I open site, the site thinks that Im from Sweden and set for me Sweden KR currency, before Cloudflare its worked good.
Thank you!
If you can’t get it to track the IP address as outlined in the article I linked to, can you customize it to use other methods?
Are you using Apache or Nginx?
We have Zone.ee hosting, there I created Wordpress App, as I understand its using Apache, for configure Apache I can edit only .htaccess file. And I can add node.js application
Thank you!
Ok, that makes things more complicated.
May I ask where you have implemented this code?
Which file exactly was it added to?
Thats not correct, please add it into your “wp-config.php
” file, so it applies globaly on your Wordpress installation… not just the Theme.
Also add it at the very top (just right after the opening PHP tag).
Then report back, if it worked and please provide a screenshot of the file where you have implemented it now, so we can assist and validate it’s done right.
Can you try this snippet?
if ( isset( $_SERVER['HTTP_CF_CONNECTING_IP'] ) ) {
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CLIENT_IP'] = $_SERVER['HTTP_X_FORWARDED_FOR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
}
Source: #1 GitHub, #2 StackOverFlow #3 GitHub
I am afraid lukapaunovic got that wrong. That header always is a single-value field.
Thanks, I updated the snippet.
Hello,
We are having the same exact problem.
We have tried to ■■■ those snippets with no luck!
Thank you.
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.