Created
March 5, 2020 12:58
-
-
Save alidemirci/d1277b7a85f26350f8709fbe260e4eee to your computer and use it in GitHub Desktop.
Change WooCommerce Text String
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* | |
* 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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source