Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xlplugins/e64da2a0780f38e6c53832e0603ae05a to your computer and use it in GitHub Desktop.
Save xlplugins/e64da2a0780f38e6c53832e0603ae05a to your computer and use it in GitHub Desktop.
Coupon Code Label Change
add_filter( 'gettext', 'woocommerce_rename_coupon_message_on_checkout' ,10,3);
// rename the coupon field on the checkout page
function woocommerce_rename_coupon_message_on_checkout( $translated_text, $text, $text_domain ) {
// bail if not modifying frontend woocommerce text
if ( is_admin() || 'woocommerce' !== $text_domain ) {
return $translated_text;
} elseif ( 'Apply coupon' === $text ) {
$translated_text = 'Special Code';
}
return $translated_text;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment