Website Building » WooCommerce » How Do I Change the Translation in WooCommerce?

How Do I Change the Translation in WooCommerce?

Last updated on January 14, 2023 @ 11:50 am

When you change the language of your WooCommerce store, some text is translated for you automatically. Other text is not translated automatically, and you might need to change it yourself. You can do this in the WooCommerce admin screens, or by editing your theme or plugin files.

In the WooCommerce admin screens, most of the text is translated automatically. However, some text might not be translated correctly, or you might want to change it for another reason.

For example, you might want to add a different translation for a product category. To change this text, go to WooCommerce > Settings > General and select the Language tab. From here, you can add a new language or edit an existing one.

If you want to edit the translation for a particular string of text, go to WooCommerce > Settings > General > Default Language. Scroll down to the “String Translation” section and enter the text you want to translate in the “Search for” field.

This will bring up a list of all the strings that contain that text. Select the string you want to edit and enter your translation in the “Translation” field.

Changing Text in Theme or Plugin Files

If you want to change WooCommerce text that isn’t controlled by settings in the admin screens, you’ll need to edit your theme or plugin files. For example, if you want to change the “Add to Cart” button text, you would need to edit your theme’s functions.php file.

To do this, go to Appearance > Editor. On the right-hand side, select your functions.php file from the list of files. Then, scroll down until you find the following code:

<?php function WooCommerce_product_add_to_cart_text() {
return __( 'Add to cart', 'woocommerce' );
}
add_filter( 'woocommerce_product_add_to_cart_text',
'woocommerce_product_add_to_cart_text' ); ?>

You can change the “Add to cart” text by changing the return value in this code. For example, if you wanted to change it to “Buy now”, you would change it to this:

<?php function WooCommerce_product_add_to_cart_text() {
return __( 'Buy now', 'woocommerce' );
}
add_filter( 'woocommerce_product_add_to_cart_text',
'woocommerce_product_add_to_cart_text' ); ?>
PRO TIP: If you are not comfortable working with code, we recommend finding a WooCommerce expert to help you make changes to your translation. Making changes to your translation can cause errors on your website if done incorrectly.
Dale Leydon

Dale Leydon

Sysadmin turned Javascript developer. Owner of 20+ apps graveyard, and a couple of successful ones.