Showing wrong initial currency when woocommerce cookie not used
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page pleaseIf you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.
Quote from gabrielle on September 24, 2021, 08:45Hi there,
I have had some issued with Cloudflare not caching my site as there is a woocommerce cookie flagging in the header:
[b]set-cookie: wp_woocommerce_session_81dc0fdc61d80aa595445a5ce1a395bf=0684cf68aeb232fa70dac3a7e0205dda%7C%7C1629376250%7C%7C1629372650%7C%7Cc4a542089cf0d958abd01ef0748cedfe; expires=Thu, 19-Aug-2021 12:30:50 GMT; Max-Age=172800; path=/; secure; HttpOnly
[/b]vary: Accept-EncodingI contacted my shopping cart plugin developer and they suggested we disable the below function:
public function maybe_set_session() { if ( is_user_logged_in() || is_admin() ) { return; } if ( isset( WC()->session ) ) { if ( ! WC()->session->has_session() ) { WC()->session->set_customer_session_cookie( true ); } } } I did this and it sorted out the cookie flag in the header and cloudflare started caching again correctly However, after doing this if I load the site in a fresh browser or incognito window, the WOOCS currency switcher defaults to USD (it would show GBP before as I am in the UK). The default currency in the plugin is GBP too. Assuming you are using the cookie mentioned above that was suppressed? Can you think of a way around this? I have had to revert back to using the function above but it means that I cant get cloudflare full caching to work which drastically slows down my site Thanks Gabrielle
Hi there,
I have had some issued with Cloudflare not caching my site as there is a woocommerce cookie flagging in the header:
[b]set-cookie: wp_woocommerce_session_81dc0fdc61d80aa595445a5ce1a395bf=0684cf68aeb232fa70dac3a7e0205dda%7C%7C1629376250%7C%7C1629372650%7C%7Cc4a542089cf0d958abd01ef0748cedfe; expires=Thu, 19-Aug-2021 12:30:50 GMT; Max-Age=172800; path=/; secure; HttpOnly
[/b]vary: Accept-Encoding
I contacted my shopping cart plugin developer and they suggested we disable the below function:
public function maybe_set_session() {
if ( is_user_logged_in() || is_admin() ) {
return;
}
if ( isset( WC()->session ) ) {
if ( ! WC()->session->has_session() ) {
WC()->session->set_customer_session_cookie( true );
}
}
}
I did this and it sorted out the cookie flag in the header and cloudflare started caching again correctly
However, after doing this if I load the site in a fresh browser or incognito window, the WOOCS currency
switcher defaults to USD (it would show GBP before as I am in the UK). The default currency in the plugin
is GBP too. Assuming you are using the cookie mentioned above that was suppressed?
Can you think of a way around this? I have had to revert back to using the function above but it means that I cant get cloudflare
full caching to work which drastically slows down my site
Thanks
Gabrielle
Quote from Pablo Borysenco on September 24, 2021, 12:22Hello Gabrielle
Assuming you are using the cookie mentioned above that was suppressed? - No!
Please read this - https://currency-switcher.com/using-geolocation-causes-problems-doesnt-seem-to-work-for-me
Check options - https://share.pluginus.net/image/i20210924132217.png
Hello Gabrielle
Assuming you are using the cookie mentioned above that was suppressed? - No!
Please read this - https://currency-switcher.com/using-geolocation-causes-problems-doesnt-seem-to-work-for-me
Check options - https://share.pluginus.net/image/i20210924132217.png
Quote from gabrielle on September 27, 2021, 00:10Thank you, I will give those options a go
Thank you, I will give those options a go
Quote from Pablo Borysenco on September 27, 2021, 11:27Hello
Welcome;)
Hello
Welcome;)
Quote from gabrielle on October 24, 2021, 00:28Hi Pablo,
I have been having issues recently with UTM URLs with spaces or %20 in them causing redirects and users getting the error message "too many redirects" and "this page isnt redirecting properly". Siteground support have worked out that its a problem with me setting Woocommerce > General > Default Customer Location > Geolocate (with caching support). If that is set, there is an issue between URLs with spaces (being used from ad platforms etc) and Cloudflare Full Page Cache. So at the moment I have had to switch it off.
They also flagged that Cloudflare Full Page cache wasnt working as the below cookie was being set on site load by the WOOCs plugin (below from header scan):
Set-Cookie: PHPSESSID=7464ce7854653c05ac4cdb54b6b2a85b; path=/If a cookie is set, then Cloudflare full page cache will bypass.
So, instead of setting Currency Storage to "PHP Session" I have changed it to Memcache (assuming it was this setting adding the cookie above?)
So, now I am testing my site. From the UK the WOOCS plugin seems to default to GBP correctly.
However if I use https://www.locabrowser.com/ to check other locations in Europe, the homepage is set to GBP (when it should be EUR). Strangely my /Shop page is set to EUR correctly.
I also have a /test page that I added the shortcode [woocs_geo_hello] to and that seems to always display the correct country
What could be causing the homepage currency to not match other pages?
Hi Pablo,
I have been having issues recently with UTM URLs with spaces or %20 in them causing redirects and users getting the error message"too many redirects" and"this page isnt redirecting properly". Siteground support have worked out that its a problem with me setting Woocommerce > General > Default Customer Location > Geolocate (with caching support). If that is set, there is an issue between URLs with spaces (being used from ad platforms etc) and Cloudflare Full Page Cache. So at the moment I have had to switch it off.
They also flagged that Cloudflare Full Page cache wasnt working as the below cookie was being set on site load by the WOOCs plugin (below from header scan):
Set-Cookie: PHPSESSID=7464ce7854653c05ac4cdb54b6b2a85b; path=/
If a cookie is set, then Cloudflare full page cache will bypass.
So, instead of setting Currency Storage to"PHP Session" I have changed it to Memcache (assuming it was this setting adding the cookie above?)
So, now I am testing my site. From the UK the WOOCS plugin seems to default to GBP correctly.
However if I use https://www.locabrowser.com/ to check other locations in Europe, the homepage is set to GBP (when it should be EUR). Strangely my /Shop page is set to EUR correctly.
I also have a /test page that I added the shortcode [woocs_geo_hello] to and that seems to always display the correct country
What could be causing the homepage currency to not match other pages?
Quote from gabrielle on October 24, 2021, 23:37Hi there, have done some more testing and have an update.
I have now set Woocommerce > General > Default Customer Location > to "Geolocate" (without caching support)
I have signed up to a VPN, and when I check my site all appears ok with homepage and shop page now showing the correct same currency
If I use https://www.locabrowser.com/ however, every country will appear as EUR, and my /test page that has [woocs_geo_hello] on it will show a geolocation of Spain for every country tried (even Japan).
Since everything seems ok when using a full VPN, I am hoping this is all setup correctly? Would it be possible to check at your end?
I cant set WooCommerce Geolocate to caching support, but maybe Siteground Dynamic Cache + Cloudflare Full Cache works without this set? It seems to from my end
Thanks
Hi there, have done some more testing and have an update.
I have now set Woocommerce > General > Default Customer Location > to "Geolocate" (without caching support)
I have signed up to a VPN, and when I check my site all appears ok with homepage and shop page now showing the correct same currency
If I use https://www.locabrowser.com/ however, every country will appear as EUR, and my /test page that has [woocs_geo_hello] on it will show a geolocation of Spain for every country tried (even Japan).
Since everything seems ok when using a full VPN, I am hoping this is all setup correctly? Would it be possible to check at your end?
I cant set WooCommerce Geolocate to caching support, but maybe Siteground Dynamic Cache + Cloudflare Full Cache works without this set? It seems to from my end
Thanks
Quote from Pablo Borysenco on October 25, 2021, 12:33Hello
Please drop me a link to this test page/(add shortcodes: [woocs_geo_hello] [woocs_show_current_currency])
Hello
Please drop me a link to this test page/(add shortcodes: [woocs_geo_hello] [woocs_show_current_currency])
Quote from gabrielle on October 25, 2021, 18:19Have added the second shortcode and added the URL of the test page into the Private Data section
Thanks
Have added the second shortcode and added the URL of the test page into the Private Data section
Thanks
Quote from Pablo Borysenco on October 26, 2021, 10:25Hello
I did a test - https://c2n.me/4dMccpB - Woocommerce cannot determine the current user location with your settings
In fact, my plugin correctly set the EUR currency for Spain.
In your case, you need to eliminate the incompatibility between Woocommerce and the caching plugin. And unfortunately it doesn't depend on my plugin.
We cannot do anything while woocommerce is not correctly detecting the location. Because our plugin takes data from woocommerce
Hello
I did a test - https://c2n.me/4dMccpB - Woocommerce cannot determine the current user location with your settings
In fact, my plugin correctly set the EUR currency for Spain.
In your case, you need to eliminate the incompatibility between Woocommerce and the caching plugin. And unfortunately it doesn't depend on my plugin.
We cannot do anything while woocommerce is not correctly detecting the location. Because our plugin takes data from woocommerce
Quote from gabrielle on October 26, 2021, 12:44Hi there,
I have done some more testing with different VPN locations with some interesting results
- If I go to the homepage or /shop page first, I see the currency switch quickly to the correct currency.
- If I then go to /test woocommerce this shows the correct location (sometimes needs a refresh)
However, if I clear my cache and:
- Go to the /test page first, woocommerce shows location mostly as Spain (no matter which country I am connecting from)
- If I then go to /Shop or Homepage the correct currency is shown
The above is true with a USA or Canadian VPN too, go to /test first then its incorrect most of the time. But then go to /Shop or Homepage and currency correctly switches to CAD.
It looks like maybe if a product price is shown on the page, that this then kicks the GeoIP into being correct? My /test page contains no products or prices, whereas the homepage and /shop pages do. Or is there another issue with the test page shortcodes or something else going on?
On the surface of it, no matter what country VPN I use, the products always show with the correct currency. But with the /test page not always being correct it is slightly worrying
Thanks
Hi there,
I have done some more testing with different VPN locations with some interesting results
- If I go to the homepage or /shop page first, I see the currency switch quickly to the correct currency.
- If I then go to /test woocommerce this shows the correct location (sometimes needs a refresh)
However, if I clear my cache and:
- Go to the /test page first, woocommerce shows location mostly as Spain (no matter which country I am connecting from)
- If I then go to /Shop or Homepage the correct currency is shown
The above is true with a USA or Canadian VPN too, go to /test first then its incorrect most of the time. But then go to /Shop or Homepage and currency correctly switches to CAD.
It looks like maybe if a product price is shown on the page, that this then kicks the GeoIP into being correct? My /test page contains no products or prices, whereas the homepage and /shop pages do. Or is there another issue with the test page shortcodes or something else going on?
On the surface of it, no matter what country VPN I use, the products always show with the correct currency. But with the /test page not always being correct it is slightly worrying
Thanks
Quote from Pablo Borysenco on October 27, 2021, 10:02Hello
It is possible. My plugin redraws prices in Ajax mode if the page is cached. But in order not to waste the server resource, this does not happen if there are no products on the page
And it shouldn't work if woocommerce can't determine the user's location.
Try to add product om test page :
[products limit="1"]
Hello
It is possible. My plugin redraws prices in Ajax mode if the page is cached. But in order not to waste the server resource, this does not happen if there are no products on the page
And it shouldn't work if woocommerce can't determine the user's location.
Try to add product om test page :
[products limit="1"]
Quote from gabrielle on November 2, 2021, 01:35I tried adding products to the test page but that didnt help
It still seems quite inconsistent. Most of the time it seems to work fine, but sometimes seems to keep the cache of the wrong currency.
How do I disable the GeoIP functionality for the plugin, so it always defaults to GBP but just lets users switch manually? If we do that will it keep to this currency for their whole session?
Thanks
I tried adding products to the test page but that didnt help
It still seems quite inconsistent. Most of the time it seems to work fine, but sometimes seems to keep the cache of the wrong currency.
How do I disable the GeoIP functionality for the plugin, so it always defaults to GBP but just lets users switch manually? If we do that will it keep to this currency for their whole session?
Thanks
Quote from Pablo Borysenco on November 2, 2021, 10:33Hello
Ok! Try to set - https://share.pluginus.net/image/i20211102113213.png
Delete all GeoIp rules - https://share.pluginus.net/image/i20211102113330.png
Hello
Ok! Try to set - https://share.pluginus.net/image/i20211102113213.png
Delete all GeoIp rules - https://share.pluginus.net/image/i20211102113330.png