18 september 2017

Translate Woocommerce.

You would think that setting your local language in the WordPress setting will automatically translates all the text on your Woocommerce pages. Well it doesn’t or gives you translations you need/want to change. However you can create custom translations with a free plugin called ‘Loco Translate’. Which is very handy if you have more than one language to translate.

More on Loco Translate:

Translate strings by custom code

If you have just one language which you need to have translations for you can translate the strings by pasting the following code in your functions.php. Always make a back-up before editing or adding code to your functions.php and you obviously need a child-theme to get this working without losing the code at each theme update.

function my_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case ‘Apply coupon’ :
$translated_text = __( ‘New Apply Coupon Text’, ‘woocommerce’ );
case ‘Have a coupon?’ :
$translated_text = __( ‘Do you have a coupon?’, ‘woocommerce’ );
return $translated_text;

add_filter( ‘gettext’, ‘my_text_strings’, 20, 3 );