0

I've spent several hours trawling for a solution to what would seem to be a fairly straighforward issue - but with no joy.

Any help on this would be massively appreciated.

I'm using my own custom theme with Woocommerce. I'd like to be able to change the message text that appears when a user updates their cart from 'Cart updated' to 'Basket updated'.

Please note: this is the message shown when a user changes the quantity of a product within the cart, and selects 'Update Cart'. I already know how to change the text of the 'Add to Cart' button, and also the message shown when an item is added to the cart ('Item was successfully added to your basket').

Any help would be very gratefully received. Thanks.

1 Answer 1

9

WooCommerce is heavily localised, so you can make use of WordPress' localisation functions to change its messages.

add_filter('gettext', 'wpse_124400_woomessages', 10, 3);

/**
* change some WooCommerce labels
* @param string $translation
* @param string $text
* @param string $domain
* @return string
*/
function wpse_124400_woomessages($translation, $text, $domain) {
    if ($domain == 'woocommerce') {
        if ($text == 'Cart updated.') {
            $translation = 'Basket updated.';
        }
    }

    return $translation;
}
2
  • Legend! This works an absolute treat. I knew it had to be a simple function to change the messages, but couldn't find any help anywhere on this. Thanks again.
    – scribbles
    Dec 19, 2013 at 10:17
  • I used this to change the "Return To Shop" link label. Thanks. Mar 8, 2016 at 19:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.