php - WooCommerce: Change the label of the “Return to shop” button in the empty cart page
one text
Solution:
WooCommerce 4.6 added some new filters and actions:
One of them:
woocommerce_return_to_shop_text
- Filter to change the label of the “Return to shop” button in the empty cart page.
So you get
/**
* Filter "Return To Shop" text.
*
* @since 4.6.0
* @param string $default_text Default text.
*/
function filter_woocommerce_return_to_shop_text ( $default_text ) {
// Add new text
$default_text = __( 'My new text', 'woocommerce' );
return $default_text;
}
add_filter( 'woocommerce_return_to_shop_text', 'filter_woocommerce_return_to_shop_text', 10, 1 );
Source