Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 - -
16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 - -

Supporter timezone: Asia/Jerusalem (GMT+03:00)

This topic contains 11 replies, has 2 voices.

Last updated by Itamar 1 year, 1 month ago.

Assisted by: Itamar.

Author Posts
April 8, 2024 at 6:03 pm #15495762

nilsN-5

As you can see something happening when I'm toggling the currency. I'm using an ajax request with wcml_switch_currency to switch the currency. What I do notice is that apply_filters('wcml_price_currency', NULL ); is empty after I've made the switch.

April 9, 2024 at 12:11 pm #15499075

Itamar
WPML Supporter since 02/2016

Languages: English (English )

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

Hi,

I'll continue to help you with this issue.

Since it is a known issue, we have, and you stated that the suggested workaround doesn't work for you, so we want to examine your setup.

Can you please put your site online and give us access?

Please put your site in a minimum environment so we can rule out any compatibility collisions.

I'm enabling a private message for the following reply.
Privacy and Security Policy
We have strict policies regarding privacy and access to your information. Please see:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/
**IMPORTANT**
- - Please backup the site files and database before providing us access. --
-- If you have a staging site where the problem can be reproduced, it is better to share access to the staging site.--

Regards,
Itamar.

April 9, 2024 at 5:51 pm #15500792

Itamar
WPML Supporter since 02/2016

Languages: English (English )

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

Hi, and thanks for the access details.

I have a few problems that hold me back from continuing to investigate this issue.

1. I can access your dev site, but I cannot access it with FTP. I get:

Error:	Could not connect to server

2. I'm getting a 502 Bad Gateway error on the front end of your site. Please see the attached screenshot.

3. Your site is not in a minimum environment. We need to check if this issue persists when only WPML and its add-ons and WooCommerce (without its add-ons) are active. All the rest of the plugins need to be deactivated.Can you please proceed with this?

4. Can you please tell me where you added the 'wcml_price_currency' code that you say does not work?

5. Please explain where and how to see the problem on the front end (when it is fixed).

I'll wait for your reply.

Regards,
Itamar.

2024-04-09_20-46-20.png
April 10, 2024 at 6:06 am #15502124

nilsN-5

It's because it needs an ssh key. Would it work if I submitted a very clean version, without the theme, and most of the plugins. I could compress it using the All-in-one migration plugin and send that file, so you can deploy it on your end? Together with a loom video on how to reproduce it.

April 10, 2024 at 10:24 am #15503708

Itamar
WPML Supporter since 02/2016

Languages: English (English )

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

Hi,

OK, this is a good idea. I'm enabling a private message for the next reply so you can share your site package and link to the video.

Thanks,
Itamar.

April 11, 2024 at 8:51 am #15507774

Itamar
WPML Supporter since 02/2016

Languages: English (English )

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

Hi, and thanks for the copy of your site and video. It really helped!

I'm unsure what went wrong in the communication between you and my colleague who first helped you. For some reason, the history of the chat is gone, and I can't see it. In the ticket summary, my colleague mentioned that he provided the workaround for you, but you said it did not work. But when I examined your code (header.php), you inserted it without the workaround. It is like this:

<?php $current_currency = apply_filters('wcml_price_currency', NULL ); ?>
<?php echo "The current currency is: " . $current_currency; ?>

Using NULL will not work. When I correct it as suggested, it works:

<?php $current_currency = apply_filters('wcml_price_currency', get_woocommerce_currency() ); ?>
<?php echo "The current currency is: " . $current_currency; ?>

I put your site on our Cloudways server. You can check that it works here.

hidden link

Please also see the attached screenshot.

You should also apply the code on your live site.

Please let me know how it goes.

Regards,
Itamar.

2024-04-11_11-48-35.png
April 11, 2024 at 2:26 pm #15509796

nilsN-5

Hi, I see that the currency shows. However, it doesn't solve the problem.

Check video here: hidden link

The mentioned plugin is WooCommerce Conditional Shipping and Payments and has WooCommerce as the author.

April 11, 2024 at 3:43 pm #15510311

Itamar
WPML Supporter since 02/2016

Languages: English (English )

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

Hi,

So, as it looks, it is not an issue of our wcml_price_currency hook but a compatibility issue with the WooCommerce Conditional Shipping and Payments plugin.

Is this this plugin?

https://woocommerce.com/products/conditional-shipping-and-payments/

If so, we might be facing a compatibility issue with this plugin which is unknown to us and not in our list here - https://wpml.org/plugin/.

We can get advanced in checking if we can help from our side. But first, please consider and try the option to "Prompt for a confirmation and reset the cart". This option can be found in WooCommerce -> WooCommerce Multilingual & Multicurrency -> Settings tab, under "Switching currencies when there are items in the cart". You can read about this option here.

https://wpml.org/documentation/related-projects/woocommerce-multilingual/clearing-cart-contents-when-language-or-currency-change/

Regards,
Itamar.

April 12, 2024 at 8:31 am #15511926

nilsN-5

That seems to be the case and yes, that's the correct plugin you're linking to.

I tried simply reloading the cart page, without even changing the product, and then the conditions worked as expected. But when toggling the currency, it shows both options again.

I realize that it's out of your scope to fix this, however, do you have any idea what might be causing this? I've spent a lot of hours digging for this, but I can't seem to wrap my head around what's causing this. So if you have any idea what so ever, I'd be happy to dig further.

April 14, 2024 at 5:13 am #15515347

Itamar
WPML Supporter since 02/2016

Languages: English (English )

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

Hi,

From experience in similar cases, I see that it might be a caching issue. But other than that, I don't know what's going wrong there. But I can esclate it to our compatibility team, and they may be helpful in this case.

For this, I created a test website with a clean WordPress install. You can access it through this link:

hidden link

With this link, you'll be directly logged in.

Could you please install the WooCommerce Conditional Shipping and Payments plugin and see if the issue is replicable on a clean WordPress installation?

Please configure WPML and WooCommerce as set on your site (just the basic configurations needed to replicate the issue are enough).

Please also ensure you install the latest version of the plugin.

Please let us know when everything is finished, and you can replicate the problem.

Regards,
Itamar.

April 15, 2024 at 12:26 pm #15519955

nilsN-5

It's installed and activated. I also configured the WooCommerce + Plugins accordingly. However, I'm not able to recreate the problem. On this installation it works. What might be the reason for this?

April 15, 2024 at 3:22 pm #15521111

Itamar
WPML Supporter since 02/2016

Languages: English (English )

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

Hi,

As I mentioned, it might be a caching issue. Often it is caching on the server side and not from a caching plugin. On the test site, I disabled all caching on the server side. Please check in this direction.

Do you have any caching enabled on your server?

Regards,
Itamar.

The topic ‘[Closed] wcml_price_currency filter stop working’ is closed to new replies.