Skip to content Skip to sidebar

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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Europe/Madrid (GMT+02:00)

This topic contains 13 replies, has 0 voices.

Last updated by Marcel 3 days, 7 hours ago.

Assisted by: Marcel.

Author Posts
September 19, 2025 at 4:25 am

xavierC-5

Background of the issue:
I am trying to switch languages on my website when there are items in the cart. The issue can be seen on this page: hidden link.

Symptoms:
I expected to see a prompt for confirmation before the cart resets. Instead, no prompt appears before the cart resets. After the cart resets, if I do not back to the Shop page and I switch languages, the prompt notice appears but redirects to a wrong URL. Additionally, the removed items notice stays on the screen and cannot be removed.

Questions:
Why does the prompt not appear before the cart resets when switching languages?
Why does the prompt notice redirect to a wrong URL after the cart resets?
How can I remove the notice about removed items from the screen?

September 19, 2025 at 6:54 am #17415442

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello,

I have escalated the issue of incorrect URL redirections to our second-tier supporters. You will receive feedback or updates as soon as your second-tier checks the issue.

Thank you,

September 19, 2025 at 7:20 am #17415460

xavierC-5

ok, thanks Shekhar.
I await news from the second tier supporters.
Regards

September 23, 2025 at 3:15 am #17423466

xavierC-5

Hi Shekhar,

Do you have any news about this issue?

Regards,
Xavier

September 23, 2025 at 3:26 pm #17426232

Marcel
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

Hi Xavier,

My name is Marcel, and I’ll be handling your ticket while my colleague Shekhar is away.

Our 2nd Tier team is currently investigating the issue. I’ll keep you updated as soon as we have feedback. It looks like there were some difficulties in replicating the problem.

Best regards,
Marcel

September 24, 2025 at 4:18 am #17427302

xavierC-5

Hola Marcel,
Thanks.

Looking forward to hearing from you.
Regards,
Xavier

September 26, 2025 at 2:15 pm #17436345

Marcel
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

Hi,

our 2nd Tier team has reviewed your case and determined that a modification to get_current_url is required. This involves replacing the code in:
woocommerce-multilingual/inc/class-wcml-cart-switch-lang-functions.php

Before proceeding, I’d like to confirm whether we have your permission to apply this change. If so, please ensure a backup is created beforehand and let us know once it has been completed.

Thank you!

Best regards,
Marcel

September 29, 2025 at 4:57 am #17439404

xavierC-5

Hi Marcel,

Thanks for the feedback.

About replacing the code on the website; I've already made a full backup but I believe you are accessing to a copy of the website.

When discussing with Shekhar, he told me, he was unable to reproduce the same issue on your staging site (environment) so he asked me to send him a full backup (copy) of the current multisite. I believe that if you are using that copy it won't affect the live site. Please correct me if I'm wrong.
Or you are now asking permission to make the changes on our live site?

Let me know.
Regards,
Xavier

September 29, 2025 at 9:49 am #17440382

Marcel
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

Hi,

Yes, we used the copy for local testing and now need permission to apply the change on the live website.

Best regards,
Marcel

September 30, 2025 at 4:36 am #17442540

xavierC-5

Hi Marcel,
Thanks.

On the Live Multisite, I did add a Staging subsite to replicate the same error/issue as on the live subsite for testing purpose. Can you apply the changes first on that staging subsite to check that works well before applying it on the live/performance subsite?
Do these changes work independently for each subsite or should be applied for the whole multisite? As the problem is only affecting one of the subsites at this moment.

Best,
Xavier

PS: please let me know if you still have full access to the whole multisite. I remember I granted to Shekhar so should still work.

September 30, 2025 at 9:12 am #17443372

Marcel
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

Thanks! Yes, the credentials we have here in this ticket are still working.

Best Regards,
Marcel

September 30, 2025 at 10:49 am #17443940

Marcel
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

Just to clarify: On a WordPress Multisite installation, all subsites share the same plugin files. That means there isn’t a separate version of WooCommerce Multilingual (WCML) running on each subsite—if we edit the plugin code, those changes would apply to every subsite where the plugin is active.

Best regards,
Marcel

October 1, 2025 at 6:27 am #17447211

xavierC-5

Hi Marcel,
All clear, thanks.

In that case, as 2 of the subsites are live and customers are actively using them to buy products, I'm a bit worry about applying these changes when I cannot supervise it due to zone time difference.

Is it possible to explain me what changes need to be done, so I can do it? I can test and in case it fails I can always use the backup to restablish the multisite.

Let me know.

October 1, 2025 at 7:13 am #17447327

Marcel
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

Hi,

sure!

1) Please make a backup.

2) Modify the function get_current_url in woocommerce-multilingual/inc/class-wcml-cart-switch-lang-functions.php, completely replacing it with this:

	public function get_current_url() {
		/* phpcs:ignore WordPress.CSRF.NonceVerification.NoNonceVerification, WordPress.VIP.SuperGlobalInputUsage.AccessDetected, WordPress.VIP.ValidatedSanitizedInput.InputNotValidated, WordPress.VIP.ValidatedSanitizedInput.MissingUnslash */

		$scheme = is_ssl() ? 'https' : 'http';
		$host   = $_SERVER['HTTP_HOST'] ?? parse_url( home_url(), PHP_URL_HOST );
		$uri    = $_SERVER['REQUEST_URI'] ?? '/'; // already includes the query string if present
		return esc_url_raw( $scheme . '://' . $host . $uri );
	}

3) Test if this works for you.

Best Regards,
Marcel