Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
You are experiencing an issue where email notifications are not being sent when using 'Bulk Actions' on the order page due to a conflict between the WPML string plugin and your order plugin. This conflict arises because both plugins use the

woocommerce_order_status_changed

hook, and the WPML-related code switches the locale to English, interrupting the email sending process.
Solution:
We recommend adding the following code snippet to your theme's functions.php file after ensuring you have a full backup:

add_action('woocommerce_order_status_changed', function () {<br />    $tag = 'woocommerce_order_status_changed';<br />    $prio = 10;<br /><br />    $callbacks = $GLOBALS['wp_filter'][$tag]->callbacks[$prio] ?? [];<br />    foreach ($callbacks as $cb) {<br />        $f = $cb['function'];<br />        if (is_array($f) && is_object($f[0]) && $f[1] === 'comments_language') {<br />            remove_action($tag, $f, $prio);<br />        }<br />    }<br />}, 0);

This code removes the WCML action that changes the locale when the other plugin calls

restore_previous_locale()

. With this adjustment, the process should complete correctly, and your emails will be sent as expected.

Please note that this solution might become irrelevant due to updates or may not apply to your specific case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the issue persists, please open a new support ticket.

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 18 replies, has 0 voices.

Last updated by walter-arielM 7 months ago.

Assisted by: Marcel.

Author Posts
September 23, 2025 at 3:42 pm #17426267

walter-arielM

Hello,

Ok. Thanks.

Please, let me know.

Regards,

September 24, 2025 at 1:25 pm #17429287

Marcel
Supporter

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

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

Hi,

so your order plugin is adding custom logic related to WPML. The issue you’re seeing is caused by that custom logic hooks into woocommerce_order_status_changed. This same hook is also used by our WooCommerce Multilingual (WCML) plugin.

The problematic code is located here:
/wp-content/plugins/bp-custom-order-status-for-woocommerce/src/Email.php

Everything works correctly until the call to restore_previous_locale(). That call triggers a chain in WooCommerce Multilingual (WCML), specifically in:

\WCML_Emails::comments_language
/wp-content/plugins/woocommerce-multilingual/inc/class-wcml-emails.php

This method sets the locale to English because of a fallback condition. Once the locale is switched to English, the process is interrupted and no further emails are sent.

There’s one catch: this issue only appears if your WordPress admin top-bar language is set to Spanish. The reason is most likely that Post Status is a Custom Post Type (CPT). Since you’re using “Display as translated” mode without providing actual translations, the defaults remain in Spanish, which triggers the mismatch.

Workaround

As a workaround, you can add the following code snippet to your theme’s functions.php after a full backup:

add_action('woocommerce_order_status_changed', function () {
    $tag = 'woocommerce_order_status_changed';
    $prio = 10;

    $callbacks = $GLOBALS['wp_filter'][$tag]->callbacks[$prio] ?? [];
    foreach ($callbacks as $cb) {
        $f = $cb['function'];
        if (is_array($f) && is_object($f[0]) && $f[1] === 'comments_language') {
            remove_action($tag, $f, $prio);
        }
    }
}, 0);

This removes the WCML action that changes the locale when the other plugin calls restore_previous_locale(). With this in place, the process should complete correctly and your emails will be sent as expected.

Best regards,
Marcel

September 25, 2025 at 3:35 pm #17433359

walter-arielM

Hello,

Thanks. I will try the code you sent me.
Please, keep open this ticket a few days more.

Regards,
Walter.

September 25, 2025 at 3:39 pm #17433378

Marcel
Supporter

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

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

Sure!

Best Regards,
Marcel

September 29, 2025 at 6:34 am #17439519

walter-arielM

Hello there,

It seems that the issue is fixed.

Thank you very much for your support.

Regards,
Walter.