How to rename the coupon field on the Woocommerce checkout page

Professional and affordable website design. Based in King's Lynn, Norfolk.

How to rename the coupon field on the Woocommerce checkout page

// rename the coupon field on the checkout page
function woocommerce_rename_coupon_field_on_checkout( $translated_text, $text, $text_domain ) {

// bail if not modifying frontend woocommerce text
if ( is_admin() || ‘woocommerce’ !== $text_domain ) {
return $translated_text;
}

if ( ‘Coupon code’ === $text ) {
$translated_text = ‘Enter custom text for Coupon code box here’;

} elseif ( ‘Apply Coupon’ === $text ) {
$translated_text = ‘Enter custom text for Apply Coupon box here’;
}

return $translated_text;
}
add_filter( ‘gettext’, ‘woocommerce_rename_coupon_field_on_checkout’, 10, 3 );

Leave a Reply

Your email address will not be published. Required fields are marked *