[Resolved] WC Email Notification showing multiple languages
This thread is resolved. Here is a description of the problem and solution.
Problem: The client is experiencing an issue where email notifications sent from their multilingual e-commerce sites viviscal.bg and viviscal-store.com are displaying in multiple languages instead of just the language in which the order was made. This problem is linked to the YAY Mail plugin's handling of languages. Solution: We recommend updating the YAY Mail plugin's code to ensure that emails are sent in the correct language. Specifically, modify the
get_site_language
function in the WPMLIntegration.php file. Here's the step-by-step guide:
Backup the original WPMLIntegration.php file located in /wp-content/plugins/yaymail-pro/includes/Integrations/Translations/.
public static function get_site_language( $order ) {
global $sitepress;
// Use default language as safe fallback
$language = apply_filters( 'wpml_default_language', null );
if ( null !== $order || isset( $GLOBALS['yaymail_set_order'] ) ) {
$order_data = ( null !== $order ) ? $order : $GLOBALS['yaymail_set_order'];
$order_language = $order_data->get_meta( 'wpml_language', true );
if ( ! empty( $order_language ) ) {
$language = $order_language;
}
}
do_action( 'wpml_switch_language', $language );
return $language;
}
After updating the code, test the email notifications to ensure they are now sent in the correct language.
If this solution does not resolve your issue or seems irrelevant due to updates or different configurations, 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 problem 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.
Background of the issue:
I am trying to manage email notifications for two connected websites, now separated, viviscal.bg and viviscal-store.com. Viviscal-store.com is translated into several languages. When sending a confirmation email for an order, the email received by the customer is a mix of languages, including English, Bulgarian, and the language in which the order was made. We have already provided access to the website for further investigation. The issue can be seen at the following link: hidden link.
Symptoms:
The email notifications sent to customers are a mix of multiple languages instead of being in the language of the order.
Questions:
Why are the email notifications showing multiple languages?
How can I ensure the email is sent in the correct language?
If the issue is still there, I'd appreciate it if you could test the steps below:
- IMPORTANT STEP! Create a backup of your website. Or better approach will be to test this on a copy/staging version of the website to avoid any disruption of a live website.
- Switch to the default theme such as "TwentyTwenty" by going to "WordPress Dashboard > Appearance > themes".
- Go to "WordPress Dashboard > Plugins" and deactivate all plugins except:
. Woocommere
. Woocommerce Multilingual
. WPML Multilingual CMS
. WPML String Translation
- Check if you can still recreate the issue.
- If not, re-activate your plugins one by one and check the issue each time to find out the plugin that causes the problem.
Hello,
This has already been done. We worked on the same case for a long time with your colleague - KOR, but the topic was closed. Making a copy is not within our capabilities.
Your colleague has copied the site, there you can safely look for the problem. If you wish, you can copy our site as well.
I hope to receive adequate support, because this problem has been here for more than 3 months
Thanks for your patience. I'm Kor and I will be handling your case from now on. Sorry the last ticket was closed due to inactivity. Since it's been a while since I last checked your site, could you please grant me permission to create a new copy of it?
Thanks for your patience. I've checked, and could you please try completing the string translations listed below? This is one of the strings that I identified that requires translation.
hidden link
Also, we don't really understand the language that you're referring to, and we're hard time trying to identify the issue. Based on your screenshot that you've provided, could you list the strings that are translated but do not reflect the email notifications that your client receives?
Hello
I am sending you the picture again. All the text that is underline is in Bulgarian. In this order it should be in Croatian, or the language the order comes from. Even the names of the products are changed in Bulgarian, when we change the order status to "Completed". We try to find this strings, but we coudn't.
Obviously the problem cannot be solved, and we need to find a solution quickly.
We have currently divided the site into 2. The main domain that we used viviscal.bg was separated and currently our multilingual site viviscal-store.com and its subdomains are a separate site. Bulgarian is set as the main language of this site, which we think is the cause of the errors. Is it possible to make the main domain Viviscal-store.com in English and set English as the main language from which to translate new content on the site. As Bulgarian can be removed entirely, because we have a separate site in Bulgarian. In this case, however, it is important that all translations of pages, products and publications that have been translated from Bulgarian remain and are not translated again, but are preserved. Only the new content should be translated.
Regarding the screenshot you shared with mixed languages in your email notification, the issue isn’t limited to Bulgarian. Other languages like Russian are also affected.
We have backup, so please add the workaround from the errata. But I think we have already done it without any effect.
We understand that this problems appears on another languages too, but for us it is important to be solved.