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
- 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+01:00)

This topic contains 3 replies, has 3 voices.

Last updated by Marcel 1 week, 4 days ago.

Assisted by: Marcel.

Author Posts
October 17, 2024 at 7:02 am #16298325

martynasA

Background of the issue:
I am trying to ensure that Woocommerce emails are sent in the correct language based on the wpml_language field from the order meta. For example, when I complete an order, a shipment tracking link gets sent by Woocommerce.

Symptoms:
Occasionally, the emails get sent in an incorrect language. I encountered it twice within the last 30 orders. For example, the last customer that made an order had the email sent in 'en', even though in 'wp_wc_orders_meta' table I can see that the 'wpml_language' field was set to 'lt' for that particular order.

Questions:
Why are Woocommerce emails sometimes sent in the incorrect language?

How can I ensure emails are sent in the language specified in the wpml_language field?

October 20, 2024 at 12:21 pm #16308655

Christopher Amirian
Supporter

Languages: English (English )

Timezone: Asia/Yerevan (GMT+04:00)

Hi,

I will try to answer this ticket before the ticket is assigned to one of my colleagues.

If you use custom code to send emails, ou need to make sure that three steps are followed according to the documentation below:

https://wpml.org/documentation/support/sending-emails-with-wpml/

If you do not have any custom code, then if the order is generated by the user int he front end, it will send the email with the language user was in the time of checkout.

If you use the WordPress Dashboard > Woocommerce > orders send email buttons there, then the email will take the language of the dashboard that you use.

You can change the dashboard language by going to Users > Profile.

Thanks.

October 26, 2024 at 5:43 am #16332799

martynasA

To clarify:

1. The email is not a custom email. It is an email that is sent by Woocommerce automatically when the order status is changed to "Completed".

2. The admin dashboard language does necessarily match the order language, but I think it is unreasonable to expect a shop manager to switch languages based on the language that the customer used during checkout.

3. As I said the issue appears to be sporadic. Sometimes the content is sent in the correct language, sometimes it's not. Interestringly, the subject is always translated correctly.

Could you please provide pointers on how to debug this further?

October 28, 2024 at 10:56 am #16337257

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

Hi,

my name is Marcel and I will take over your ticket.

Without clear steps to reproduce the issue, troubleshooting will be challenging. Ideally, please start by setting up a staging environment. Disable all unused plugins, switch to a default theme like Storefront, and place a few test orders. If we can replicate the issue there, we can then examine a duplicator copy for local debugging.

Best Regards,
Marcel