Created
February 12, 2017 05:15
-
-
Save tolkadot/f88519d43fb3914c04497660af8457c0 to your computer and use it in GitHub Desktop.
woocommerce_rename_coupon_messages
This file contains hidden or 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
// rename the coupon field on the cart page | |
function woocommerce_rename_coupon_messages( $translated_text, $text, $text_domain ) { | |
// bail if not modifying frontend woocommerce text | |
if ( is_admin() || 'woocommerce' !== $text_domain ) { | |
return $translated_text; | |
} | |
if (strpos($translated_text, 'Coupon') !== false) { | |
$translated_text = str_replace('Coupon', 'Promo Code', $translated_text); | |
} | |
else | |
if (strpos($translated_text, 'coupon') !== false) { | |
$translated_text = str_replace('coupon code', 'Promo Code', $translated_text); | |
} | |
return $translated_text; | |
} | |
add_filter( 'gettext', 'woocommerce_rename_coupon_messages', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment