Question: How to change all instances of “Cart” word to “Toolbox” throughout Website in WooCommerce.
The easiest way to do this is too create/edit a WooCommerce language file.
Here are steps to do so,
- First of all go to directory,[wordpress]/wp-content/plugins/woocommerce/i18n/languagesYou see 2 files:woocommerce.pot
woocommerce-admin.potThese are language files and we need to edit them. These contain the strings used in the front end and the admin side respectively.
- Copy these two files to somewhere to edit( we doesn’t want to modify core files)
- Download and install Poedit
We can create/edit language files using Poedit a translations editor, which we can use for WordPress.
- Open the file woocommerce.pot (which is used for Front end ) in Poedit
- Select option “Create new translation”
- Select the language you want the translation file in ( in this case English UK )
- Find the word throughout the file (using find command i.e Cntrl + F )
- Adding a translation where you find instances of “cart” . e.g. “Add to Cart’”, create a translation “Add to Toolbox”.
- Do these steps recursively until there is no word found.
- When you done, save the file as woocommerce-en_GB.po . This will create 2 language files for woocommerce (woocommerce-en_GB.po and woocommerce-en_GB.mo )
- Now go to your website and in wp-content, create a folder called languages (if one doesn’t exist already) and inside languages folder create new one called woocommerce
so you have [wordpress]/wp-content/languages/woocommerce
- Its in this folder that we need to put the woo language files (created in step 4) that will override the default WooCommerce language file (if one exists for UK english).
So drop woocommerce-en_GB.po and woocommerce-en_GB.mo in the WordPress directory:
- That’s It, have a fun.
- Look at your website and see how all the places that Cart appeared have changed to Toolbox.
When ever you update WooCommerce plugin, your files remains unchanged.