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

Last updated by Oscar Miras 4 months, 2 weeks ago.

Assigned support staff: Oscar Miras.

Author Posts
May 24, 2019 at 7:19 am #3881713

frankH-26

Hi,

I'm adding additional texts to woocommerce emails, e.g. Terms & Conditions and Right of Withdrawal via a function in my child theme. I add thoses texts by getting content form the original posts with get_post(), so if somebody makes changes to the Terms & Conditions, those changes are automatically reflected in the woocommerce emails.

So far so good. But our shop has two languages, german and english. By now I differentiate the additional texts language by get_locale(). But this is not the right way, e.g. if a german speaking shop manager submits a processing email to the english speaking customer, thoses texts are german.

So how does WPML chooses in which language a woocommerce email is sent?

Is there a function I can use to get the same choice?

Thank you very much.

May 24, 2019 at 9:28 am #3882957

Oscar Miras

Hi,

Welcome to the WPML support team.

If I understood it correctly, you need to retrieve those texts based on the order client's language.

Thus, this information is stored wpml_language meta_key of the order.
In addition, WPML is going to send the email in the language based on that field.

You can get more information and some screenshots on this ticket: https://wpml.org/forums/topic/how-to-find-the-language-of-a-product/#post-3111697 . Have a look at the screenshots, they are quite clarifying.

Should you need further assistance do not hesitate to contact me again.

Kind regards,
Oscar.

May 27, 2019 at 8:56 am #3894879

frankH-26

Hi,

thank you very much. This was a good advice. I was able to retrieve the meta_key to differentiate the additional texts language.

But unfortunately WPML is not using this metay_key to send emails. The emails have mixed language.

If set up the wpml_language as a custom field, so I can change the language of my test order.
And my custom additional texts are now going to inserted in the email based on the meta_key (de = german, en = english).

See attached Screeshots.

May 27, 2019 at 11:02 am #3896329

Oscar Miras

Hi,

Thank you for your response.

How are you creating this email template? Are you using the WooCommerce Send Emails to do so or maybe you are creating your own Woocommerce templates?

Thank you,
Oscar.

May 27, 2019 at 11:08 am #3896357

frankH-26

Hi,

I'm using the standard email templates from woocommerce. I just 'subclassed' the email-header.php and email-styles.php files in my child theme.

Thank you,
Frank

May 27, 2019 at 11:12 am #3896401

Oscar Miras

Hi,

I would like to request you temporary access to your WordPress installation. Please, make sure you have a full backup of your site before granting me access. The best way to do it is to create a new user with administrator privileges and share with me the credentials in the provided boxes.

In addition, I would like you to ask for permission to install Duplicator plugin, in case I need to perform full export of your site to perform more tests in our servers.

Thank you for your collaboration,
Oscar.

May 29, 2019 at 6:00 am #3912023

Oscar Miras

Hi,

Thank you for all your work. The access to the site works perfectly.

I can already see that there is one order in On Hold status. I would like to know: is this order experiencing the issue? If so, which text do you expect to be in a different language? If that order is correct, could you generate a new one in this site and point out what texts are wrong?

Thank you,
Oscar.

May 29, 2019 at 6:51 am #3912177

frankH-26

Hi Oscar,

well you see that the text in this email has mixed languages. E.g. Product, Quantitiy, Price.
But: Farbe, Rot, versandkostenfrei...

If I search in WPML String Translations for the word "versandkostenfrei" I do find it under the domain woocommerce, and the english wording is "Free shipping" and the german translation is "versandkostenfrei".

So, although the wpml_language meta is set to "en", there are german texts in the email.

Thank you,
Frank.

May 29, 2019 at 10:51 am #3914341

Oscar Miras

Hi,

I've made several tests and updated the Woocommerce plugin. There was also an update to Woocommerce Multilingual plugin.

After that, I switched to the Storefront Woocoomerce theme. Email orders looked like to be generated correctly (you can check them in WP Mail Log).
Afterwards, I switched back to BeTheme child and the mail sending order has been generated completely in English.

Could you perform some additional tests and share the result to confirm if the issue is gone?

Thank you,
Oscar.

May 31, 2019 at 8:51 am #3928643

frankH-26

Hi,
thank you for your effort. I made additional tests and can confirm that with the storefront theme the language seems to be ok. Unfortunately, with the storefront theme no emails are sent. Well, the emails are in the WP Mail Log, but I don't recieve the emails with my email client.

Anyway, it seems that the problem with the mixed language has its cause in the theme. That does not help very much, because I cannot simply switch the theme.

So, I have to think about it.

Thank you very much.

Frank

May 31, 2019 at 12:15 pm #3930397

Oscar Miras

Hi,

It may help to have a look at our documentation about how to go multilingual for custom themes and WPML. This one focus on creating Woocoomerce themes: https://wpml.org/documentation/support/making-woocommerce-themes-multilingual-and-multi-currency-ready/

Finally, you can also hire one of the certified contractors that will help you to achieve compatibility between your theme and WPML: https://wpml.org/contractors/

Should you have any further request, do not hesitate to contact me again.
I'll be happy to help.

Best wishes,
Oscar.