Tuesday, 8 May 2018

Change Cart Updated message in woocommerce

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

No comments:

Post a Comment