[Resolved] How to change currecy using a url parameter
This thread is resolved. Here is a description of the problem and solution.
Problem:
This was an issue with the currency symbol in the mini cart widget in the header. It didn't change to the current symbol when the cart was empty.
Solution:
We checked this issue on our side and found it was not an issue with WPML or WooCommerce Multilingual & Multicurrency. It was an issue with the custom code by the user.
0% of people find this useful.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
WooCommerce Multilingual's currency switcher works fine even if there are no products in the cart. When using it the currency symbol changes even if the cart is empty. Please see the attached screenshots. But with your custom code, it is not working when there are no products in the cart.
I'm sorry for not mentioning this earlier, but please be aware that in our support forum we can support custom code. If something is not working for you with one of our hooks and you can show us what is not working, we'll investigate why it is happening and advise you how to use it or fix it if from our side needed. But otherwise debugging a custom theme or plugin is out of the scope of this forum. Please read about it at the following link.
Our second tier supporter checked this issue and found out that if the JS is disabled for this page this hook works as expected even for the mini cart widget. Please see the attached screenshot. So this means that JS from the theme is changing this back to the other currency symbol. And it also means that there is no wrong with our hook.
You can try to use another hook that we have. The wcml_multi_currency_ajax_actions hook.
You would need to include the AJAX actions in the array of the hook. But I'm not sure if it will work. Maybe a collision with the widget when the cart does have items in it will occur.
Otherwise, please find a custom way to disable the JS of the mini cart widget when there are no items in the cart.
In my personal opinion, when there are no items in the cart it is understandable that the currency is not changing there and it is not such a big problem.
Yes, it is the custom code that has this issue.
It is not in WPML or WooCommerce Multilingual.
Regards,
Itamar.
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.