Skip to content

Instantly share code, notes, and snippets.

@tolkadot
Created February 12, 2017 05:15
Show Gist options
  • Save tolkadot/f88519d43fb3914c04497660af8457c0 to your computer and use it in GitHub Desktop.
Save tolkadot/f88519d43fb3914c04497660af8457c0 to your computer and use it in GitHub Desktop.
woocommerce_rename_coupon_messages
// 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