Skip to content

Instantly share code, notes, and snippets.

@pavr0m
Created March 11, 2020 12:39
Show Gist options
  • Save pavr0m/d544db4a80f41e7e651871fdca9cbbf4 to your computer and use it in GitHub Desktop.
Save pavr0m/d544db4a80f41e7e651871fdca9cbbf4 to your computer and use it in GitHub Desktop.
Wordpress. Change text using gettext function.
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 cart' :
$translated_text = __( 'Back to Shop', 'woocommerce' );
case 'Return to basket' :
$translated_text = __( 'Back to Shop', 'woocommerce' );
break;
}
return $translated_text;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment