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.

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Long Nguyen 2 years, 10 months ago.

Assisted by: Long Nguyen.

Author Posts
May 29, 2023 at 9:21 am #13730615

Carl

We have a site using WPML and WooCommerce Subscriptions.

Subscribers on our site can checkout using either English or Swedish.

We have noticed that automatic emails (renewal payment failed, renewal order completed etc.) sent from the site doesn't always seem to be in the desired language, as we have English speaking customers sometimes receiving emails in Swedish.

Questions:

1) How are the language of automatic emails determined?
2) What is the wpml_language meta data that are stored on subscriptions?
3) Any filter we can use to add our own logic when WPML/WP/WC determines language of emails sent?

May 31, 2023 at 4:46 am #13743129

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English ) Vietnamese (Vietnamese )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi Carl,

Thank you for contacting WPML support, I'd be happy to help you with this issue.

It sounds like this issue https://wpml.org/forums/topic/woocommerce-email-translation-issues-2/

The renewal emails of WooCommerce Subscriptions aren't sent to the customer in the language of the subscription. Please try the workaround below and see if it helps:
❌ IMPORTANT: Please backup your database and website before proceeding ❌

1. Update all WPML, WooCommerce and their addon plugins to the latest version. Please read more in the documentation https://wpml.org/faq/install-wpml/#checking-for-updates

2. Edit the file wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/emails/class-wcs-email-completed-renewal-order.php, around line 78, change the code from

function trigger( $order_id, $order = null ) {

to

function trigger( $order_id, $order = null ) {
	if (class_exists('sitepress')) {
		do_action('wpml_switch_language', get_post_meta($order_id, 'wpml_language')[0]);
	}

3. Go to WooCommerce > Settings > Emails > Renewal emails > Actually type a "Subject" and "Email heading" content.

4. Go to WPML > String Translation and translate it. Be sure that you are translating the strings under the domain "admin_texts…". Please follow the documentation https://wpml.org/documentation/related-projects/woocommerce-multilingual/how-to-translate-woocommerce-emails/

Look forward to your reply.
Thanks

June 5, 2023 at 6:01 am #13767359

Carl

Thank you, I will try it out!

June 5, 2023 at 9:34 am #13768473

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English ) Vietnamese (Vietnamese )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

I'm waiting for your feedback.

Thanks.