Skip to content

Instantly share code, notes, and snippets.

@LaurenaRehbein
Created April 11, 2019 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save LaurenaRehbein/ef38073ec10d36ba3911f5a08e344a05 to your computer and use it in GitHub Desktop.
Save LaurenaRehbein/ef38073ec10d36ba3911f5a08e344a05 to your computer and use it in GitHub Desktop.
A filter to change text using gettext filter. This one changes the WooCommerce/Storefront mini cart.
<?php
/**
* Change the “No products in the cart” message when hovering over the mini-cart
*
*/
function lar_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case ‘No products in the cart.’ :
$translated_text = __( ‘new text here’, ‘woocommerce’ );
break;
}
return $translated_text;
}
add_filter( ‘gettext’, ‘lar_text_strings’, 20, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment