Skip to content

Instantly share code, notes, and snippets.

@alidemirci
Created March 5, 2020 12:58
Show Gist options
  • Save alidemirci/d1277b7a85f26350f8709fbe260e4eee to your computer and use it in GitHub Desktop.
Save alidemirci/d1277b7a85f26350f8709fbe260e4eee to your computer and use it in GitHub Desktop.
Change WooCommerce Text String
/*
*
* Change WooCommerce Text String
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*
*/
function amc_change_woo_string( $translation, $text, $domain ){
if ( !is_admin() && $domain == "woocommerce" )
switch ($translation) {
case 'Add to cart':
$translation = __("Changed Text", "woocommerce");
break;
case 'Sale!':
$translation = __("Changed Text", "woocommerce");
break;
}
return $translation;
}
add_filter( 'gettext', 'amc_change_woo_string', 15, 3 );
@alidemirci
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment