Skip Navigation

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.

This topic contains 34 replies, has 2 voices.

Last updated by Itamar 4 years ago.

Assisted by: Itamar.

Author Posts
August 30, 2020 at 12:35 pm #6901675

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

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.

https://wpml.org/purchase/support-policy/

Nevertheless, I'm waiting for an answer from our second-tier supporter whether he can give one more advice about this issue.

I'll keep you updated here.

Regards,
Itamar.

August 31, 2020 at 3:42 pm #6908777

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

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.

https://wpml.org/wcml-hook/wcml_multi_currency_ajax_actions/

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.

Regards,
Itamar.

2020-08-31_18-32-35.jpg
September 1, 2020 at 9:56 am #6913981

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

Our second tier supporter has checked further the Ajax request and found out that it is the default WC request.

hidden link

This request refreshes the cart. And the problem is that this request does not contain the URL parameter so the user gets the default currency.

I hope that this information is helpful to you.

Regards,
Itamar.

September 2, 2020 at 4:48 pm #6928067

ghadaha

I m strange ... hidden link this JS why not working on When i have product..

When product its working fine.,,,

is we need to include any woo commerce file( class) in plugin? if its not available?

May be when product available that time its taking that class?

I can assume that my custom code have issue...

let me check this file

But i have a question..

I have not seen any ajax call in console....

September 2, 2020 at 8:54 pm #6929259

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

Yes, it is the custom code that has this issue.
It is not in WPML or WooCommerce Multilingual.

Regards,
Itamar.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.