WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
[resolved] Change 'Cart Updated' message (5 posts)

  1. philhambley
    Member
    Posted 7 months ago #

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

    If anyone can help on this, or just point me in the right direction, it 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.

    http://wordpress.org/plugins/woocommerce/

  2. ManusH
    Member
    Posted 7 months ago #

    Most of the theme and plugin "texts" are controlled by "multilingual" language files.
    As far as I know from my experiences, I totaly changed every text in my theme and woocommerce intallations, because I'm not using English and I had to change them all to my own language.

    So it will be a good start to look for the plugin:
    Codestyling Localization
    http://wordpress.org/plugins/codestyling-localization/

    There is even a tutorial in WooThemes site about the usage of the plugin in WooCommerce.

    Btw, in order to use this plugin, your theme must be "multilingual" compatible, so it is a bit related to your theme.

    If it is not compatible to be multilingual, then you may need to change the core files of the theme.

  3. philhambley
    Member
    Posted 7 months ago #

    Thanks for your help ManusH (much appreciated), but I can't help thinking that this is massive overkill for something that is such a small change.

    I really don't want to have to install an additional plugin (my whole site only uses 2 plugins - including Woocommerce) just to change the text on a message.

    I've trawled and trawled the web looking for a simple answer to this, and am amazed that there doesn't seem to be anything written up about this.

    Surely changing the message text is a common procedure for Woocommerce users?

  4. ManusH
    Member
    Posted 7 months ago #

    Btw; you don't have to left the plugin active after you make your change.

    It is a simple plugin to make a translation within the WordPress, so after you make your changes, you can deactivate the plugin and you go on using your minimumum number of plugins on your site.

    Even you can make that change in another test area, such as another server or even your local machine, then upload only that newly generated language file, so don't even activate the plugin in your server...

    It is that simple, not so complicated.

  5. philhambley
    Member
    Posted 6 months ago #

    I eventually found the easiest solution to this. Add the following to your functions.php file:

    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;
    }

Reply

You must log in to post.

About this Plugin

About this Topic