We’ve talked about how you can change text in WordPress themes and plugins by using Loco Translate, but what if you would rather not install a plugin to make one small text change? You can do that with a small bit of code. Add this to your functions.php file or with a plugin like Code Snippets.
function ijab_change_string( $translated_text, $text, $domain ) {
$translated_text = str_replace('Add to cart', 'Add to basket', $translated_text);
return $translated_text;
}
add_filter( 'gettext', 'ijab_change_string', 100, 3 );
The “Add to cart” is the original text and the “Add to basket” is the updated text. Change those to match what you want to change and that’s all there is to it.

Leave a Reply