Skip Navigation

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

Problem:

Custom order received endpoint redirects to default language if using classic checkout block/shortcode

Solution:

This issue is fixed with the latest version of WooCommerce Multilingual & Multicurrency - 5.3.2. Please update to the latest version.

Relevant Documentation:

https://wpml.org/download/woocommerce-multilingual-multicurrency/?section=changelog

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

Last updated by Itamar 11 months ago.

Assisted by: Itamar.

Author Posts
November 30, 2023 at 8:58 pm #14967625

T4ng

Ok, great you could finally observe the issue by yourself.

To reproduce it with Stripe, enable the WooCommerce Stripe Gateway plugin, then click Settings > Settings thubmnail > Tick test mode, and save.
Then place an order from the french part of the website again with the Credit Card (Stripe) payment method.
You'll get redirected to the English checkout/order-received/ page instead of the french one.

Finally, you'll probably also notice that if you try to select a specific country for the Stripe payment method, you could save it, but then as soon as you want to refresh the page, you'll realize you can't save that setting.
cf screenshots.

Thank you

firefox_7LFyTSrIGT.png
firefox_Xb7Cmjv87i.png
December 4, 2023 at 8:30 am #14983013

T4ng

Hi,

Any update on that topic? The interface now says I might not get more info about this issue here, since it's been escalated.
How will I know when it's solved?

Thanks

December 4, 2023 at 11:32 am #14986011

Itamar
Supporter

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

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

Hi,

I'm still waiting for a reply from our compatibility team about this issue. I just sent them a reminder. I'll update you here once I have their answer.

I appreciate your patience.
Itamar.

December 4, 2023 at 11:47 am #14986191

T4ng

Understood, thanks Itamar.

December 5, 2023 at 7:38 pm #15002455

Itamar
Supporter

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

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

Hi,

Our compatibility team has a workaround for this issue. Please test it on your site.

1. Take a backup of your site in case something goes wrong.

2. Edit the functions.php file of your theme with a code editor.

3. Add the following code to the file.

/**
 * Add this code to the functions.php file of your theme.
 */
add_filter( 'wcml_client_currency', 'modify_client_currency', 10, 1 );

function modify_client_currency( $currency ) {
	preg_match('/order-pay\/(\d+)/', $_SERVER["REQUEST_URI"], $matches);
	if ($matches) {
		$currency = get_post_meta( $matches[1], '_order_currency', true );
	}
	return $currency;
}

4. Save the file.

5. Check if the problem is fixed.

Please let me know the result.

Thanks,
Itamar.

December 6, 2023 at 8:20 am #15004377

T4ng

Hi Itamar.
Thanks for this code, we'll give it a try, and tell you how it goes.
Why our environment requires this, while others don't?

December 6, 2023 at 8:37 am #15004757

Itamar
Supporter

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

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

Hi,

Our compatibility developer just informed me it is a new known issue. It is not specific to your environment. We have published an errata with the details about this case and a workaround (a different workaround than what I shared with you.) Please see it in the following link and try the suggested workaround.

https://wpml.org/errata/wcml-custom-order-received-endpoint-redirects-to-default-language/

Regards,
Itamar.

December 6, 2023 at 8:58 am #15004975

T4ng

We gave a try to both solutions. None of them work, with the last versions of the plugins.
We have a custom checkout, which doesn't work with blocks.
We used to integrate the checkout though a Classic [woocommerce checkout] block, which your last version doesn't seem to support.

December 6, 2023 at 2:39 pm #15008877

Itamar
Supporter

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

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

I see.

I communicated your answer to our compatibility developer and will update you once I have news about this issue.

December 6, 2023 at 3:06 pm #15009083

Itamar
Supporter

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

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

Hi,

Our developers have improved the patch on the errata. Please try it once again.

1. Take a backup of your site in case something goes wrong.

2. Open the wp-content/plugins/woocommerce-multilingual/wpml-woocommerce.php file.

3. Around line 128, Change:

WCMLOrderNotesHooks::class,

For:

//WCMLOrderNotesHooks::class,

Regards,
Itamar.

December 6, 2023 at 3:21 pm #15009193

T4ng

Are you 100% sure of this modification?
I can't find any occurrence of:

WCMLOrderNotesHooks::class

in that file, neither in from WooCommerce Multilingual 5.3.1 nor 5.3.0.

December 6, 2023 at 3:46 pm #15009623

T4ng

Ok, my bad, I think the editor removed the slashes.
I was looking for an exact match. Sorry about that.
The modification works with the 5.3.1 version 🙂

December 6, 2023 at 6:53 pm #15011645

Itamar
Supporter

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

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

Great, I'm glad it works now!

The issue has been escalated to our developers, and a permanent fix will be included in future versions of WooCommerce Multilingual & Multicurrency. I'll update you once the version with the fix is released.

December 13, 2023 at 9:27 am #15052047

Itamar
Supporter

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

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

Hi,

This issue is fixed with the latest version of WooCommerce Multilingual & Multicurrency - 5.3.2.
Please update to the latest version.

I'm closing this ticket.

Regards,
Itamar.