Ecommerce Shopify WordPress Discussion

How to insert just few words in WooCommerce translated strings

Searching how to modify just a few words in the «new account» WooCommerce email to customer. I'm building WooCommerce shop in French, but it will be multilanguage. I have to make this change in the theme for this new account mail and also for the «my account» page. I Need to change the phrase in the new account mail to customer like this: …vos commandes, créer ou changer votre… where "créer ou" is inserted. And in the «my account» page: …ainsi que créer ou changer votre… where "créer ou" is inserted. Please take a look at the screenshots: WooCommerce email notification - new account to customer: WooCommerce wording in my account page: i have tried to edit the specific woocommerce template in the theme code, but if change this words in english because the template is in english, its generating a email in english. So making changes there keeping the translation options is over my basic knowledge.
You can use the following, to insert a string into some translated strings: add_filter( 'gettext', 'customize_woocommerce_translated_strings', 10, 3 ); function customize_woocommerce_translated_strings( $translated_text, $original_text, $domain ) { // Not in cart or checkout pages $targeted_string1 = 'changer votre mot de passe et les détails de votre compte'; $targeted_string2 = 'changer votre mot de passe, et plus encore ici'; $string_to_insert = 'créer ou '; if( is_account_page() && strpos( $translated_text, $targeted_string1) !== false ) { $translated_text = str_replace($targeted_string1, $string_to_insert.$targeted_string1, $translated_text); } if( ! is_admin() && strpos( $translated_text, $targeted_string2) !== false ) { $translated_text = str_replace($targeted_string2, $string_to_insert.$targeted_string2, $translated_text); } return $translated_text; } Code goes on functions.php file of your child theme (or in a plugin). Tested and works. On my account dashboard: On New account email notification: Note: You can also use Loco Translate plugin to change translated strings.

February 26, 2024

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.