Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
You have set up the multi-currency function in WPML with German as the default language and linked the currency CHF to the German language. However, when visiting a product page, the currency switches back to EUR after 2 seconds.
Solution:
This issue is related to the

BM_Update_Price::update_price()

method, which is hooked to AJAX. To fix this, you need to add it to our AJAX filters using the wcml_multi_currency_ajax_actions filter.
Add the following code to the functions.php of your theme:

// WPML Workaround for compsupp-7663<br />add_filter( 'wcml_multi_currency_ajax_actions', 'wpml_compsupp7663_add_actions_to_multi_currency_ajax', 10, 1 );<br /><br />function wpml_compsupp7663_add_actions_to_multi_currency_ajax( $ajax_actions ) {<br /><br />    $ajax_actions[] = 'update_price'; // Add a AJAX action to the array<br />    return $ajax_actions;<br /><br />}

Please test this solution and provide feedback. If it resolves the issue, we recommend sharing this workaround with the plugin developers.

If this solution does not apply to your case, or if it seems outdated, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If issues persist, please open a new support ticket.

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 12 replies, has 2 voices.

Last updated by johannesB-16 3 weeks, 5 days ago.

Assisted by: Christopher Amirian.

Author Posts
November 8, 2024 at 7:49 am #16380819

johannesB-16

Hi,
correct, the currency is changing with the language.
But there is something wrong with the USD currceny. It keeps the amount from EUR so there is now conversion applied.
If I change from EUR to CHF, conversion rate is applied.

wpml_usd.png
November 8, 2024 at 9:28 am #16381250

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi,

That seems to be not related to the original issue that the ticket is opened for.

Would you please test if you deactivate the B2B plugin and also remove the code from functions.php of the theme the same problem happens?

Thanks.

November 8, 2024 at 10:40 am #16381632

johannesB-16

Hi,

I've deactivated the B2B-Market and removed the snippet. The issue does not occur anymore.

However, when the plugin is activated and the snippet is included, the issue does also not occur when I switch to the Twenty Twenty-Four Theme.
Therefore I've contacted the ASTRA development team.
I'll keep you updated if they have any suggestions.

November 10, 2024 at 8:16 am #16385190

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Ok, thank you for informing us.

November 18, 2024 at 10:25 am #16414074

johannesB-16

Hi,

I have looked into the problem with the ASTRA developers. We discovered that the problem also occurs with the Twenty Twenty-One theme.
This means that it is not necessarily related to the ASTRA theme.

The problem currently behaves as follows:

The currency conversion works with the Twenty Twenty-four theme, but not with the Twenty Twenty-one theme and ASTRA theme.
The problem with these two themes is that the currency conversion works between EUR and CHF, but not between EUR and USD.
This means that the amount does not change between EUR and USD.

Can you make sense of this?

Kind regards.

November 19, 2024 at 8:39 am #16418016

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi,

Thank you for the info. As we were in contact with the B2B Markets dev team they have mentioned that they will release a version that would fix the issue and you will not need to add any code to functions.php

Let's wait for their release as that would be the best solution rather than our temporary workaround.

Please update B2B Markets after the release and test.

Thanks.

November 19, 2024 at 4:08 pm #16420723

johannesB-16

Hi,

I just updated B2B Market and removed the code snippet from the workaround.
And it's working like before - currency is not switching back (which is good) but the USD currency is still displaying the EUR amount. CHF conversion is working.

November 21, 2024 at 2:20 pm #16429557

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi,

Sorry for my late reply. I do appreciate your patience with the issue as it seems this is something that needs to be checked with the developers of the plugin again.

I know it will be hard, but I'd appreciate it if you could once more install the B2B Market on the installation below (please use the latest version) and replicate the issue there and get back to us with the steps to see the issue so I can report this to the compatibility team:

hidden link

Thanks.

November 22, 2024 at 2:20 pm #16434201

johannesB-16

Hi,
I have installed Astra theme and the B2B Market plugin. I have also tried to set up everything like it's on my staging site. But unfortunately I can't replicate the issue on your sandbox. I will take another look into the installation on monday.

Have a nice weekend!

Kind regards

November 25, 2024 at 1:55 pm #16440088

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi,

Thank you. If needed please deactivate all other plugins except WPML and B2B Market and test.

Thanks.

November 28, 2024 at 11:13 am #16454537

johannesB-16

Hi,

I deactivated and uninstalled B2B Market on my staging site.
Then I uploaded the plugin again, activated it and imported all settings from the previous installation.

Now everything seems to be working👍🏻

Thanks a lot for your support!