PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

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

Detect when user changes currency

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.

Hi!
I wonder if it is possible to detect, maybe through a hook, when the user changes the currency in the site, so I can empty the cart items.

Hello

In this case, you need customization of the code.

It depends on the type of switcher. What switcher are you using? I will tell you where is the js code that switches the currency

Hello Pablo,

Do you mean I would need some ajax call when click the selector?

I am using Desplegable ddslick switcher.

Many thanks!

See woocommerce documentation. There must be JS functions to empty the cart

To  get  click   on ddslick  in  file - \wp-content\plugins\woocommerce-currency-switcher\js\front.js  -  here - https://share.pluginus.net/image/i20211001124254.png OR  here - https://share.pluginus.net/image/i20211001124343.png

Yes, WooCommerce has a php function for that.

The problem I see is that I have to alter the mentioned js to add an ajax call to achieve this. I don't think it is the best way, as I will lost changes in every plugin update.

Hello

You can override this JS function(woocs_redirects)