Created
January 21, 2014 23:53
-
-
Save maxrice/8550927 to your computer and use it in GitHub Desktop.
WooCommerce - rename the "Apply Coupon" field on the cart page
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
<?php | |
// 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'; | |
} | |
return $translated_text; | |
} | |
add_filter( 'gettext', 'woocommerce_rename_coupon_field_on_cart', 10, 3 ); |
it works. check case of the 'apply coupon'. It might be Apply coupon!
Thanks @zakirsajib, I looked and mine WAS 'Apply coupon'. I changed the case and it worked on the button text!! TY!
Not working. Checked case as well.
In our case it was changing the capital 'C' to lowercase. Thanks for posting!
if ( 'Apply coupon' === $text ) {
$translated_text = 'Apply Membership Discount';
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
dont work.