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.

This topic contains 13 replies, has 2 voices.

Last updated by Yvette 1 year, 8 months ago.

Assisted by: Yvette.

Author Posts
August 22, 2022 at 9:06 pm #11907917

Santiago

Hello there,

I think I discover a big problem with WPML and the WooCommerce customer email notifications.

I can create an order in some additional language, like German (DE) and the customer receives the email in the right language with the right texts.
And if I check the "show original" email code, I can see the:
<html lang=3D"de-DE" style=3D"height: 100%; position: relative;" height=3D"=100%">
In the second line, that's perfect.

Then is not work anymore in the right language when I change the order status on WooCommerce.
Like if I change to processing, completed, etc.
Also, if I check the "show original" email code, I can see the:
<html lang=3D"en-US" style=3D"height: 100%; position: relative;" height=3D"=100%">
Should be de-DE as the original order language, for some reason all the emails are en-US now and don't show the right language texts.

Can you setup a sandbox WP installation to show all this?
Also, you can replicate the problem as I mentioned.
Some idea about how to fix it?
We need to send the emails in the right language to the customers.

Thank you in advance.-

August 23, 2022 at 10:26 am #11911105

Yvette
Supporter

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

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

Hello

Here is the sandbox site you requested:
hidden link

Please replicate the issue there and then write back with steps I need to execute to see it myself.

August 23, 2022 at 11:12 am #11911575

Santiago

Hello Yvette and thank you for your update!

I have created a video to share the problem.

1.- For new orders add the right code on the header, which is = lang="de-DE"

2.- And additional actions like changing the order status, etc. don't.
They add the default language code = lang="en-US"

I share both steps in the video.
hidden link

Some idea about why this is happening?
Looks like is a popular problem around, I can see different tickets like this on your forum, but no solutions.

Thank you in advance.-

August 23, 2022 at 11:42 am #11911747

Santiago

An additional detail.
The "Kadence WooCommerce Email Designer" plugin already has the German .PO file.
Also, if I add the translations manually, still shows English texts for the additional actions mails.
This makes sense because have the lang="en-US" on the code.
The question is why is not using lang="de-DE"

August 23, 2022 at 11:57 am #11912017

Yvette
Supporter

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

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

Hello

Part of the issue is that Woocommerce plugin was not scanned so some of the template strings were not available for translation.

Vid: hidden link

However, even with this, the body is still not translating and this I can escalate as a bug.

Did you notice this on other emails - I can confirm it happens with order-completed - but is there another one that you have noticed and can recreate on sandbox?

August 23, 2022 at 12:06 pm #11912089

Santiago

Hello there,

1.- I do copy all the .PO files to every possible location,
kadence plugin - language folder,
wp-content - language folder,
wp-content - language - plugins folder,
wp-content - woocommerce folder,
etc.

2.- Also, I manually add all the translations via WPML string translation,

I do all this on different empty & clean WP installations.
With no extra plugins or commercial themes.
And still exactly the same, with every action email, except the first one.
This makes sense because they are not the ang="de-DE".

Do you have some idea about some temporal solution?

August 23, 2022 at 4:03 pm #11914347

Yvette
Supporter

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

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

This issue has been escalated to our compatibility team for more work and a workaround. Please be patient while I wait for a response from them

August 23, 2022 at 4:57 pm #11914845

Santiago

Also, I have tested different plugins and had the same problems with every plugin.
https://wordpress.org/plugins/kadence-woocommerce-email-designer/
https://wordpress.org/plugins/yaymail/
https://wordpress.org/plugins/decorator-woocommerce-email-customizer/

August 26, 2022 at 1:14 pm #11937705

Santiago

Hello there, I also have a conversation with the Kadence plugin support team and here is the last message from them:

***

Kadence WP Support <help@kadencewp.com>

Hi!

I asked our developer and here is what he said:

"I’ve heard of Woocommerce/WPML struggling with correct language when the admin is triggering the event because they focus on current user language. However, this was supposed to be fixed with WPML's WooCommerce integration.

I’m running some tests but note that the language in the code of the email will always be based on the current user that triggers the email, you can turn off our plugin and that will still be the case. WPML was supposed to add a filter to change out the text based on the order and which language the order was made but it won’t set the language it just means it will filter the strings. which is likely where the issue is, in that WPML isn’t looking at Kadence strings."

"Because, without your plugin, the WooCommerce default email design works perfectly..."
As mentioned by our developer, I also tested deactivating our Kadence WooCommerce Email Designer to see if the incorrect language will also be used if the email was triggered in the admin area.

Here's a screen recording for your reference - hidden link. As you have seen, the Thai language was used correctly for the emails on actual orders but when I change the order status, my site language(English) was used.

I hope this gives you more information. Let us know if we can assist you further.

Kind Regards,
Karla

August 29, 2022 at 8:33 am #11947205

Yvette
Supporter

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

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

Hello

Please verify that the following code added to the functions.php file has resolved the issue on this sandbox:
hidden link

Code:

$option_key = 'kt_woomail';
add_filter( 'option_' . $option_key, [ wpml_st_load_admin_texts(), 'icl_st_translate_admin_string' ] );
August 29, 2022 at 3:35 pm #11951097

Santiago

Thank you again for your help,
I'm testing different orders and looks like it's working with your snippet code.
Looks like the copyright still not working, means, showing the English version:
Copyright © 2018 Sandbox, All rights reserved.
Some idea how to fix it?
Thank you again.-

August 29, 2022 at 6:21 pm #11952409

Yvette
Supporter

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

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

Is the copyright appearing in the email? or somewhere else?

August 29, 2022 at 6:23 pm #11952415

Santiago

Yes. On the emails footer.

August 29, 2022 at 6:29 pm #11952551

Yvette
Supporter

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

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

OK. Snippet changed as follows.

$option_key = 'kt_woomail';
add_filter( 'option_' . $option_key, [ wpml_st_load_admin_texts(), 'icl_st_translate_admin_string' ] );
$option_key = 'woocommerce_email_footer_text';
add_filter( 'option_' . $option_key, [ wpml_st_load_admin_texts(), 'icl_st_translate_admin_string' ] );

This is following the instructions as described in this errata:
https://wpml.org/errata/woocommerce-e-mails-are-always-sent-in-default-language-for-any-admin-order-status-change/

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