Last active
February 4, 2019 23:18
-
-
Save bekarice/34f107986cdc15f1dbd7 to your computer and use it in GitHub Desktop.
Rename coupon field in WooCommerce cart
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
// rename the coupon field on the cart page | |
function woocommerce_rename_coupon_field_on_cart( $translated_text, $text, $text_domain ) { | |
// bail if not modifying frontend woocommerce text | |
if ( is_admin() || 'woocommerce' !== $text_domain ) { | |
return $translated_text; | |
} | |
if ( 'Apply Coupon' === $text ) { | |
$translated_text = 'Apply Promo Code'; | |
} elseif ( 'Coupon code' === $text ) { | |
$translated_text = 'Promo Code'; | |
} | |
return $translated_text; | |
} | |
add_filter( 'gettext', 'woocommerce_rename_coupon_field_on_cart', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment