PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]
Botoscope is currently in early access

Support Forum

You need to log-in to create request (topic) to the support

Issues with cached pages ajax and currency switched after update 2.4.9

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 please
If 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.

Some of my visitors warned me that currencies were hard cached on the site (i.e some pages in AUD and others in CAD) . After diggin I found this https://pluginus.net/support/topic/fox-currency-switcher-pro-v1-4-9-currency-selector-not-working-on-cached-pages-rollback-request/ which matches with the last update. i've used the latest rollback, so I accidentally rolled back to the free version 1.4.3, as WPVivid Backup didn't stored uploaded files.
I've attempted to download version 2.4.8 but I can't find how. There is no rollback repository there
https://codecanyon.net/item/woocommerce-currency-switcher/8085217

The issues are that currency selector is not working for guest visitors, who receive cached pages, and also  with logged visitors which receive non-cached pages sometimes the currency selector doesn't reloads the site, it seems is doing nothing. Ajax price load seems that is not working at all on cached files.

All this was working perfectly before version 2.4.9.

If a fix for this will be released soon, I can wait with the free version 1.4.3 which works well for me (but maybe vulnerable and exploitable?) so I better maybe disable the plugin for security, and if a fix will take long I will appreciate a way to download 2.4.8, which maybe I'm missing on codecanyon

Hello

Thank you for the detailed report, it helps a lot.

First, your download question. The previous premium versions are included in your CodeCanyon purchase, but only inside the full package. In your CodeCanyon Downloads, for FOX - Currency Switcher choose"All files and documentation" (not"Installable WordPress file only"). After you unzip that package there is an"archive" folder inside that contains the last several releases, including 2.4.8 and 2.4.7. That is why you could not find them on the item page: they ship inside the bundle, not as a separate repository.

Please also note that you are currently on the free version 1.4.3, which is a separate and much older codebase. To move forward you should reinstall a premium build first.

The likely fix for the cached-pages problem. FOX has a dedicated option for sites that use caching. When a site is cached, the displayed currency gets baked into the cached HTML, which is exactly the behavior you described (some pages stuck in AUD, others in CAD). Enabling the caching option in the FOX Options tab (I am using cache plugin on my site) moves currency handling to the front-end (client side), so a single cached page can show and recalculate the correct currency, and the AJAX price refresh works on cached pages.

Please do the following:
1. Reinstall a premium version (the latest 2.4.9 is fine to start with).
2. In the FOX Options tab, enable the caching option.
3. Fully clear every cache (caching plugin, host or server cache, and CDN if you use one).
4. Test the shop as a guest visitor and check whether the switcher and the AJAX prices now work.

About rolling back. If you prefer to roll back instead, please note that 2.4.8 and 2.4.9 are very close, so 2.4.8 will most likely behave the same way. The meaningful difference is at 2.4.7, since a lot of code changed between 2.4.7 and 2.4.9. So if you want to roll back to a known-good state, use 2.4.7 from the archive folder, not 2.4.8.

One important note. Your report actually describes two different situations. The guest and cached-page problem is what the caching option above is meant to solve. But you also mentioned that for logged-in visitors on non-cached pages the switcher sometimes does nothing. That part is not caching-related, so please confirm separately whether it still happens after you enable the option and clear the cache. If it does, it points to something else and we will investigate it directly.

So that we can pinpoint this, after the steps above please tell us specifically, for each case, whether it now works:
1. guest visitors on cached pages
2. logged-in visitors on non-cached pages
3. AJAX price refresh on cached pages

If it is still not resolved, please share access to the site (or to a staging copy) and the exact page URL in the private area of this ticket, and we will reproduce it on our side.

On security: staying on the old free 1.4.3 long term is not ideal. The better path is to move to a current premium build. If you need to wait for any reason, temporarily disabling the plugin is a reasonable precaution in the meantime.

 

I’ve attempted the next workarounds witn no success:
- Updated to version 2.4.9
- Enable the caching option on FOX CS
- disable Wordfence
- Cloudflare currently disabled for staging site (only DNS mode with no proxy)
- Flush Object Cache repeteadly
- Supercache is currently disabled. Tried to enable/disable/delete with always worng results. Enable it from https://staging.smokingsweeties.com/wp-admin/options-general.php?page=wpsupercache

The main issue right now is that (with cache and cloudflare disabled) when one user changues the currency, it affects to the others, so each user changes currency globally. When enabling cache, everything gets chaotic. Randomly the currency switcher is unresponsive in the product page inside the popup. Not with previous versions before 2.4.7

I've added private data with credentials and links.

Hello Fran

We have good news. I have uploaded a new build of FOX directly to your staging site. It is not published yet (it is not on CodeCanyon or on our site at the moment), so please treat it as a pre-release build for testing.

  1. Currency being shared between visitors

This was the main problem and we have fixed it.

The reason: when the plugin stores the selected currency in transients, the storage key was built from the visitor IP address. In most setups that is fine, but as soon as visitors come through a proxy, a NAT, a corporate or mobile network, or a hosting layer that does not pass the real client IP to PHP, many different visitors end up sharing the same key. They then also share the same stored currency, which is exactly what you described: one visitor switches the currency and it changes for everybody.

What we changed: when the storage type is Transient and the option"I am using cache plugin" is enabled, the plugin now generates a random key once in the browser and keeps it in localStorage. That key is sent with every AJAX request and is used as the storage key instead of the IP. So every browser now has its own currency, regardless of how many visitors share one IP address.

An important side effect: this mode does not set any cookie, so your pages stay fully cacheable. That matters for you because page caching and Cloudflare normally break as soon as the plugin sets a session cookie on the first visit.

  1. Switcher not responding and AJAX prices not refreshing

We also found and fixed a JavaScript bug in the price refresh: in some cases the AJAX response was parsed twice, which threw an error and stopped the prices from being redrawn. This affected the Smart Designer switcher in cached mode in particular, which is the one you use in the popup with the sd=1 shortcode.

  1. The shortcode not rendering in the Bricks popup

I opened your paywall popup template, enabled"Fetch content via Ajax", saved it and tested the product page. The switcher rendered correctly and the literal [woocs sd=1] text no longer appears. So this looks fixed by the update as well.

What we would like you to check

Please test on the staging site as it is now and tell us the result for each case:

  1. Two different devices on two different networks, for example a computer on Wi-Fi and a phone on mobile data. Switch the currency on one and confirm that the other one is not affected. Please avoid testing with two tabs on the same machine, since that is the same IP and it does not prove anything.
  2. The popup on a product page: does the switcher render and does it actually switch.
  3. The prices: do they refresh correctly after switching, on the product page, in the popup and in the cart.

Once those look good, please turn your caching back on step by step, first the caching plugin and then Cloudflare, clearing all caches between the steps, and test again as a guest visitor. Please keep the storage type set to Transient and the option"I am using cache plugin" enabled, because the new logic works only in that combination.

Please let us know how it behaves and we will continue from there.

p.s. your support expired please renew it here https://currency-switcher.com/downloads - do not do it on codecanyon please as we moved from there

https://share.pluginus.net/image/i20230222134241.png
https://share.pluginus.net/image/i20230222134615.png
https://share.pluginus.net/image/i20230222134511.png