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.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 13:00 9:00 – 13:00 9:00 – 13:00 8:00 – 12:00 8:00 – 12:00 -
- 14:00 – 17:00 14:00 – 18:00 14:00 – 18:00 13:00 – 17:00 13:00 – 17:00 -

Supporter timezone: Europe/Zagreb (GMT+02:00)

Tagged: 

This topic contains 8 replies, has 0 voices.

Last updated by Bruno Kos 2 days, 7 hours ago.

Assisted by: Bruno Kos.

Author Posts
July 8, 2025 at 2:52 pm #17214786

Ivano

Background of the issue:
I am trying to translate custom emails created with the 'Order Status Manager for WooCommerce' plugin. I have added the custom text strings to WPML's 'String Translation' by using the 'Translate texts in admin screens' feature. I translated the string with the following details: Domain: admin_texts_woocommerce_wc_order_status_email_3254_settings, Name: [woocommerce_wc_order_status_email_3254_settings]body_text, String: Your order is now.....

Symptoms:
The custom emails remain in English only, despite being translated in WPML's 'String Translation'. WooCommerce standard emails are translated correctly.

Questions:
Why are my custom emails not being translated despite being added to 'String Translation'?
How can I ensure that custom emails created with 'Order Status Manager for WooCommerce' are translated correctly?

July 9, 2025 at 8:30 am #17217505

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

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

Apologies — I know we already went through this yesterday, but unfortunately, we've encountered an unexpected issue with the sandbox database, and I'm no longer able to access it properly.

Could I kindly ask you to please do the following again in the sandbox?

1. Install the Order Status Manager for WooCommerce
2. Set the string in the email again
3. Translate the relevant strings
4. Place an order for the test product I created
5. Resend the email

This will allow me to check the email logs.

Here’s the sandbox link:
hidden link

Thanks again for your help and patience — I really appreciate it!

July 12, 2025 at 12:08 pm #17230184

Ivano

Apologies for delay — I read now your message.

Points 1 to 5 are done.

Order #104.
Email sent on July 12, 2025 @ 12:04:42 pm (triggered on status changes to "Goods ready"

Thanks.

July 14, 2025 at 9:17 am #17232655

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

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

This has been escalated to our Compatibility team and may take some debugging time, I'll get back to you as soon as I have any news or questions for you.

July 16, 2025 at 6:23 am #17240089

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

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

Can you please try the following?

1. Edit your `functions.php` file (preferably in a child theme) and add the following code:

// WPML Workaround
add_action( 'woocommerce_order_status_changed', 'switch_language_before_order_email', 5, 3 );
function switch_language_before_order_email( $order_id, $from, $to ) {

    if ( $to !== 'goods-ready' ) return;

    $order = wc_get_order( $order_id );
    $current_lang  = $order ? $order->get_meta( 'wpml_language', true ) : null;
    do_action( 'wpml_switch_language', $current_lang );

}

add_action( 'woocommerce_order_status_changed', 'restore_language_after_order_email', 20, 3 );
function restore_language_after_order_email( $order_id, $old_status, $new_status ) {
    if ( $new_status === 'goods-ready' ) {
        do_action( 'wpml_restore_language', null );
    }
}

2. Edit the plugin file at
wp-content/plugins/woocommerce-order-status-manager/src/class-wc-order-status-manager-order-status-email.php

Find this line:

return (string) apply_filters( "wc_order_status_manager_order_status_email_body_text_{$this->id}", $this->format_string( $this->body_text ), $this->object, $this );

Replace it with:

		$body_text = $this->body_text;
		if ( class_exists('Sitepress') ) { 
			do_action( 'wpml_register_single_string', 'woocommerce-order-status-manager', "Email {$this->id} - Body text", $body_text );
			$body_text = apply_filters( 'wpml_translate_single_string', $body_text, 'woocommerce-order-status-manager', "Email {$this->id} - Body text" );
		}
		return (string) apply_filters( "wc_order_status_manager_order_status_email_body_text_{$this->id}", $this->format_string( $body_text ), $this->object, $this );

3. Go to WooCommerce > Settings > Emails, open the relevant custom email, and re-save it.

4. Go to WPML > String Translation and search for the email body text under the text domain `woocommerce-order-status-manager`, then provide translations as needed.

5. To test the result, go to WooCommerce > Orders, and change the order status back and forth between “On hold” and “Goods Ready” to trigger the email notification.

6. Check your email logs to confirm if the translated version is being sent.

Does it work now?

July 22, 2025 at 3:54 pm #17260272

Ivano

Sorry, the email notifications on this ticket were not active, I read now, I will try.
Thanks

July 23, 2025 at 10:16 am #17263117

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

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

Ok, let me know how it goes. As for the email notifications, I can see that emails are active for your account now, so I suppose you activated it within the top of this ticket, above the first reply?

July 24, 2025 at 4:48 pm #17268765

Ivano

Hi Bruno.

Yes, I activated email notification in the top of the ticket 😉

I followed your instructions (points 1 - 6) and it works.

But there is a difference with the standard emails.
Those standard (i.e. 'order completed') are sent in the Order language (I think meta_key `wpml_language` in wp_postmeta ).
Instead 'Good ready' emails are sent in the User setting language.

It would be better if they worked like the standard ones.

Thanks

July 25, 2025 at 11:54 am #17270897

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

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

Let me see with our compatibility developer if this is something that can be implemented perhaps through hooks, or if this is something coming from the WooCommerce Order Status Manager and can be only changed within their plugin.

I will keep you posted!