How many times did you encounter a “Add to Cart” button or “View Cart” button on your WooCommerce website and you wanted to change it to something else, and didn’t know how?

In this code snippet we can change any string we want (as long as it’s not a string with variables, it may be harder).

In the following example we used that snippet to change WooCommerce’s ‘View Cart’ button’s text to ‘View Shopping Cart’. As you can see, we also replaced ‘Categories’ and ‘Recent Posts’ phrases to other values. Make sure you specify the correct text domain instead of ‘theme_domain’ as in the code example.

function new_text_strings( $new_text, $text, $domain ) {
    switch ( $new_text ) {
        case 'View Cart' :
            $new_text = __( 'View Shopping Cart', 'woocommerce' );
		case 'Categories' :
            $new_text = __( 'Topics', 'theme_domain' );
		case 'Recent Posts' :
            $new_text = __( 'Newest Posts', 'theme_domain' );
    return $new_text;
add_filter( 'gettext', 'new_text_strings', 20, 3 );

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?