Plugin Woocommerce: Translate all email sent to customers

Version 3.1.7 of the Weglot WordPress plugin introduces a new feature that allows you to translate all Woocommerce emails related to an order sent to customers.

When an order is created, the language of the user is then recorded in the meta data of the order concerned (the language is not saved if the order is created from the original language of the site). When a Woocommerce email is then sent to a customer and it concerns an order, this email will then be translated if the order is linked to a language.

To work, you must also have activated the 'translate mail' option in the Weglot plugin options page.

This feature is disabled by default in this version. Here are 2 methods to activate this feature.

Method 1: Custom Plugin

To activate this feature, you can create PHP file named "weglot-wooccommerce-translate-following-mail.php" in your plugins directory (wp-content/plugins/) with this content :

<?php
/**
 * Plugin Name: Weglot - Wooccommerce translate following mail
 * Plugin URI: weglot.com
 * Description: Use weglot to translate all Woocommerce emails related to an order sent to customers.
 * Author: Weglot Team
 */

add_filter( 'weglot_woocommerce_translate_following_mail', '__return_true' );

Then, go to your WordPress plugin option page and activate the plugin "Weglot - Woocommerce translate following mail".

Method 2: Plugin Code Snippets

You can add and activate the plugin code snippets (https://fr.wordpress.org/plugins/code-snippets/) and use it to add the following filter :

<?php
add_filter( 'weglot_woocommerce_translate_following_mail', '__return_true' );

Last updated