Please make sure to update to WPML 4.3.6 and check our list of Known Issues before reporting

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

Last updated by Ankit 3 years, 1 month ago.

Assigned support staff: Ankit.

Author Posts
November 14, 2016 at 3:40 pm #1136207

FilippoZ1

I am trying to: Translate Custom Order statuses created with Woocommerce Order Status manager (https://woocommerce.com/products/woocommerce-order-status-manager/) and customized email messages associated with the status.

URL of (my) website where problem appears: hidden link

I expected to see: I followed the FAQ on docs (https://docs.woocommerce.com/document/woocommerce-order-status-manager/) so i translated both the Custom Status and its Email like i do with regular post types and WPML. And I've been careful that the status slug was the same across languages.

Instead, I got: both translations of the same status are available along with all others statuses as they were 2 different statuses, and not translations of the same status.
Even emails are sent twice: both the english and the non english custom status email are sent to customers.

As sub-problem, the non-english custom status email contains strings in english (order date, titles on order details table, and title on "customer details"".

Steps to duplicate the issue:

1) instal Woocommerce
2) install Woocommerce Order Status Manager Plugin
3) Install WPML (with all addons needed to translate woocommerce) and Woocommerce Multilingual
4) Go to Admin->Woocommerce->Settings->Order statuses create a custom status and a customized email associated with it
5) make Order statuses and Email translatable by WPML
6) translate custom status (screenshot --> hidden link)
7) translate customized email associated with Custom status (screenshot --> hidden link)
8) both status and its translations, are present in "order Actions" (screenshot --> hidden link)
9) when an admin changes order status, automatic email notification is sent twice (original and translation) to the same email address (screenshot from gmail --> hidden link)
furthermore, text inside emails are a bit mixed. In the italian email (main language) there are a lot of english strings (that are correctly translated in other statuses emails), and in english email there are localized strings added via template filter that are not sent in english but in italian (translations are present in template .po/mo files).

What should be the right way to have multilingual custom order statuses?

PS: i've already read and tried what suggested in the links below:
- https://wpml.org/forums/topic/wpml-not-translating-statuses-from-the-order-status-manager-plugin-woothemes/
- https://wpml.org/forums/topic/woocommerce-order-status-manager-and-order-statuses-not-translatable/
- https://wpml.org/forums/topic/woothemes-order-status-manager-custom-emails-translation/

November 15, 2016 at 6:38 am #1136549

Ankit

Hi,

This is Ankit from wpml support. I will assist you with the issue.

Thanks for listing the steps to reproduce the issue, but just for my information I would like to ask if you've tested these steps on clean install yourself?

1. If not, can you please deactivate all non-related wpml plugins and switch to default wordpress theme, check if similar issue still persists or not? If not, then please activate the deactivated plugins one by one and check if issue appears. If all the plugins are activated and issue is not appearing, activate your theme and check if issue appears.

This can be somewhat non-trivial task, so it will be better if you can perform this test on development/staging server of your website.

// IMPORTANT: Please take database backup of your website before performing these steps, it may require in case something goes wrong.

2. If you were able to reproduce issue on clean install, I would like to reproduce issue on my install as well, so that I can report the same to my compatibilit team. Could you please send me zip file (link to zip file, you can upload it on drobox or google drive) of the plugin, so that I would be able to test the issue on my install? I've enabled private message for your next reply, so that only you and me would be able to view the message.

Regards,
Ankit

November 17, 2016 at 3:50 pm #1138705

FilippoZ1

I managed to translate Order Statuses name.
To make things work I have to set the admin language to English (even if the default language is different).

Translating Custom Statuses Emails, on the contrary, it's not possible via WPML.
Custom email strings (mail subject, heading and body) are not found in WPML string translation, no matter how many times I scan the plugin with WPML.

I solved anyway using Plugin and Woocommerce hooks.

This is how (thanks to Fulvio Notarstefano for his hints in comments of this post hidden link)

here the 3 hooks necessary

1) Mail Subject
woocommerce_email_subject_wc_order_status_email_{email id}

2) Mail Heading
woocommerce_email_heading_wc_order_status_email_{email id}

3) Mail Body
wc_order_status_manager_order_status_email_body_text_wc_order_status_email_{email id}

replace the {email id} part with the ID of the email of the corresponding custom status you have added (screenshot hidden link)

I post here my functions, just to help anyway that may need this:

 


// 1) Mail subject
add_filter( 'woocommerce_email_subject_wc_order_status_email_4691', 'wc_order_status_manager_order_shipped_subject', 99, 2 );
function wc_order_status_manager_order_shipped_subject($subject, $order){
    $order_id = $order->get_order_number();
    $blog_title = get_bloginfo( 'name' );
    $order_language = get_post_meta( $order_id, 'wpml_language', true );

    switch ($order_language) {
        case 'it':
            $subject =    'Il tuo Ordine da '.$blog_title.' è stato spedito';
            break;
        // english
        default:
            $subject =    'Your order on '.$blog_title.' has been shipped';
    }

    return $subject;
}

// 2) Mail heading
add_filter( 'woocommerce_email_heading_wc_order_status_email_4691', 'wc_order_status_manager_order_shipped_heading', 99, 2 );
function wc_order_status_manager_order_shipped_heading($heading, $order){
    $order_id = $order->get_order_number();
    $order_date = date_i18n( get_option( 'date_format' ), strtotime($order->order_date));
    $order_language = get_post_meta( $order_id, 'wpml_language', true );

    switch ($order_language) {
        case 'it':
            $heading =    'Il tuo Ordine del '.$order_date.' è stato spedito';
            break;
        // english
        default:
            $heading =    'Your Order of '.$order_date.' has been shipped';
    }

    return $heading;
}

// 3) Mail body
add_filter('wc_order_status_manager_order_status_email_body_text_wc_order_status_email_4691', 'wc_order_status_manager_order_shipped_body_text', 99, 2);
function wc_order_status_manager_order_shipped_body_text($body_text, $order){
    $order_id = $order->get_order_number();
    $order_language = get_post_meta( $order_id, 'wpml_language', true );

    switch ($order_language) {
        case 'it':
            $body_text =    'Il tuo ordine è stato spedito <br>
                            A breve verrà contattato dal corriere con il numero di tracking<br><br>
                            Di seguito potrai vedere i dettagli del tuo ordine:';
            break;
        // english
        default:
            $body_text =    'Your Order has been shipped. <br>
                            The curier will soon provide you with tracking details. <br><br>
                            Please find your order details below:';
    }

    return $body_text;
}

I hope WPML devs will improve the compatibility with this plugin, it's not rare find WC sites that use it.

November 17, 2016 at 4:20 pm #1138729

FilippoZ1

I forgot, there's still one place where Custom Order Statuses are still translated in a way I can't understand: order filters in order list page.

As you can see in this screenshot hidden link:

- Core statuses remains in english even if I translated them (and the admin language is not english)

- Custom statuses remains in the default website language, even if I created also the english version

here a screenshot of Statuses in italian (default website language) hidden link

and here a screenshot of Statuses translation in English hidden link

November 17, 2016 at 4:33 pm #1138744

FilippoZ1

Sorry if I keep updating this post, but I keep finding weirdnesses.

Tooltips over status icons remains in italian (original core statuses names), no matter what I do.

I really can't figure out if there's a pattern or not.

November 18, 2016 at 10:22 am #1139215

Ankit

Hi,

I am reopening this ticket assuming that issue is not solved yet completely and you still need assistance.

1. Firstly, I could not see "Order Status Manager" plugin is compatible to wpml https://wpml.org/documentation/woocommerce-extensions-compatibility/, so this might be a compatibility issue as well.

2. In order to debug things further, I will need copy of plugin folder. Could you please send me zip file of latest version of plugin, so that I can investigate issue further? You can upload it on dropbox/google drive and send me the link, please let me know if this is fine so that I can enable private reply for your next message.

3. Even though workaround posted by you maybe working here: https://wpml.org/forums/topic/translate-woocommerce-custom-order-statuses-manager-and-their-emails/#post-1138705, but this is not ideal way to translate email strings and hence our compatibility team may want to contact plugin author to confirm the things out.

4. Regarding this issue: hidden link, can you please let me know what happens when Order Status Manager plugin is deactivated? Are those core statuses seems translated or not?

Please let me know your response, so that we can proceed.

Regards,
Ankit

November 18, 2016 at 10:40 am #1139229

Ankit

Hi,

Sorry for the first point. I confirm that this plugin is listed as compatible to wpml, I have received the plugin file and I will try to reproduce the issue as stated.

I will get back to you once I investigate the problem.

Thanks for your patience.

Regards,
Ankit

November 18, 2016 at 11:18 am #1139276

FilippoZ1

Thanks Ankit,

I'll be waiting for a response 🙂

about point 3, you are right. This is a unconfortable workaround. But I can't wait to get this the right way as I'm on a production site. I will be happy to revert all to a common WPML translation. But untill I don't understand how it works and if it works I'll be going with the filters.

about point 4, this issue: hidden link , the eanswer is: if I deactivate the Woocommerce Order Status Manager, translations works correclty. If I switch admin lang to english they are in english, if I switch back in italian, they are in Italian. (remember: default language is Italian, even if I usually keep admin in english).

PS: I'm not able to switch admin language via user profile (I switch it, but it keeps using the default language). But this is another story.

November 21, 2016 at 6:18 am #1140258

Ankit

Hi,

I've investigated the issue and following are my observations based on it.

** Order status emails are not getting sent twice

1. I've created one status "VIP Order" (In English) and translated it to Italian "VIP Order IT"

2. I've created one email "VIP Order email" (In English) associated with "VIP Order" and translated it to "VIP Order email IT" (in Italian)

3. Enabled both the emails. Condition is added to both the emails that if status changes from "any" to "VIP Order" (For English) and from "any" to "VIP Order IT" (for Italian), mail will be dispatched. See screenshot-1, please let me know if you have any sort of this condition in your configurtion or not?

4. Once the order status is changed, only a single mail is sent in corresponding language, either in English or in Italian. So for now, email seem to be working fine at my end.

** Core statuses are not translated

I acknowledge this issue as same is happening at my end.

** Both the statuses are showing up in dropdown menu (English and Italian)

Yes, this is also happening at my end.

** Tooltip for status is showing in English for core statuses on order list page

Yes, I also observed this issue in my install.

I am escalating the issue which I observed and can reproduce, to my compatibility team member. For email related point, could you please answer my queries, so that we can proceed accordingly?

Regards,
Ankit

November 21, 2016 at 7:25 am #1140285

Ankit

Hi,

I've reported the mentioned issues (which I managed to reproduce) to my compatibility team and they will further work on issue.

I will keep you posted of any updates over the same.

Regards,
Ankit

November 21, 2016 at 9:08 am #1140357

FilippoZ1

Hello Ankit,
actually I've managed to solve the double status on actions dropdown.
I can't say how it happened, but I'm using standard WPML translation of the statuses and it's working.

All the other issues are still there, even the double email sent (that I have in 2 different installations) so I'm forced to translate the mail with filters as I posted above.

November 21, 2016 at 9:10 am #1140364

Ankit

Hi Filippo,

Could you please let me know if you have added any condition for email in configuration (Like, if status changes from one status to another)?

Regards,
Ankit

November 21, 2016 at 10:53 am #1140486

FilippoZ1

i tried both having different condition and having just one condition "from any to my status".
always 2 mails sent.

November 21, 2016 at 12:03 pm #1140589

Ankit

I would request you consider providing me with temporary access (wp-admin and FTP) to your site in order to be of better help.

You will find the needed fields for this below the comment area when you log in to leave your next reply (See attachment). The information you will enter is private which means only you and I can see and have access to it.

November 23, 2016 at 5:28 am #1142161

Ankit

Hi,

Thanks for providing the staging site. I did following and observed these points.

1. I've placed an order without making payment, so order status is "waiting for payment"

2. I went to Edit Order page and changed status from "waiting for payment" to "Shipped" (Speditto)

3. Once the status is changed, I received only single email in corresponding email. If the order is for Italian product, I received email in Italian and vice versa for English.

Thus, at this point I see no 2 email issue.

Could you confirm if you receive 2 emails (in Italian and English) once the order status is changed on staging site?

Regards,
Ankit