PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]
Cyber Monday 2021
Cyber Monday 2021 timer

Support Forum

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

Detect when user changes currency

This support system is for all types of the plugins as for premium versions, so for free ones! If you have premium version do not forget in the private data of the request (!!not in the text of the support request!!) after its publishing insert purchase code please (see blue-green button on the right side) and press Save button.
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.stackovergo.com/image/i20211001124254.png  OR  here - https://share.stackovergo.com/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)