Changing Shop Language - Cart to Basket

Hi there,

My site is in the UK and I therefore want to use ‘Basket’ instead of ‘Cart’. I read that I can change this by amending the language in my wp-config file, which I’ve done, but it didn’t work. I was therefore wondering if something in X-Theme was overriding the changes and if this is something you’re aware of and can help me change it.

I also need to change ‘Coupon’ to ‘Voucher’. Again, I made an edit, this time to the coupon php file, but again, nothing changed.

Any ideas are greatly appreciated. Or if you no of a plugin that will override everything and I can make easy changes, that too would be cool.

Ta

Ant

Hi There,

Thanks for writing in! Could you please try adding the following code into your child theme’s functions.php file.

function my_custom_cart_strings($translated_text, $text, $domain) {
	$translated_text = str_replace("Coupon code", "Voucher", $translated_text);
	$translated_text = str_replace("Cart", "Basket", $translated_text);
	
return $translated_text;
}
add_filter('gettext', 'my_custom_cart_strings', 100, 3);

Hope that helps.

Hi @mldarshana, that very nearly did the trick. The text replaced in a number of places, but not all of them. So I did manage to figure out most of the other ones, just by adding more replacement strings, so thank you for the tip, it lead to me solving most of the others.

The only one I still can’t get is the one in this image, which only appears after you’ve added an item to the basket:

Any ideas on this one at all please?

Thank you.

Ant

Hi There,

Please update the previous code to this:

function my_custom_cart_strings($translated_text, $text, $domain) {
  $translated_text = str_replace("Coupon code", "Voucher", $translated_text);
  $translated_text = str_replace("Cart", "Basket", $translated_text);
  $translated_text = str_replace("View cart", "View basket", $translated_text);
  return $translated_text;
}
add_filter('gettext', 'my_custom_cart_strings', 100, 3);

Hope it helps :slight_smile:

Hi Thai, yup, that did the trick, thank you very much :smiley:

You’re welcome.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.