Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WooCommerce how to change the "return to shop" button text? [closed]

I can change the button link using the woocommerce_return_to_shop_redirect hook, but i cannot find a "nice" way to change the button text.
I would avoid modifying the core file wp-content/plugins/woocommerce/templates/cart/cart-empty.php every time woocommerce gets updated.

Any other ideas?
Thanx.

like image 656
j.c Avatar asked May 12 '17 16:05

j.c


1 Answers

You can do it this way. I have changed 'shop' to 'store' in the following example.

add_filter( 'gettext', 'change_woocommerce_return_to_shop_text', 20, 3 );

function change_woocommerce_return_to_shop_text( $translated_text, $text, $domain ) {

        switch ( $translated_text ) {

            case 'Return to shop' :

                $translated_text = __( 'Return to Store', 'woocommerce' );
                break;

        }

    return $translated_text;
}
like image 162
Dkor Web Services Avatar answered Oct 27 '22 22:10

Dkor Web Services