From: Anthony Talarico Date: Wed, 15 Feb 2017 16:46:59 +0000 (-0500) Subject: changing the coupon text to promo code in the checkout page X-Git-Tag: v1.0.10^2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=3af04de12aabb7b0be38789a208b3efba8cb8a34;p=WP-Themes%2Fcapstone.git changing the coupon text to promo code in the checkout page --- diff --git a/functions.php b/functions.php index c9cb5b2..1d04915 100644 --- a/functions.php +++ b/functions.php @@ -256,6 +256,28 @@ function remove_billing_fields( $fields ) { return $fields; } +// rename the "Have a Coupon?" message on the checkout page +function woocommerce_rename_coupon_message_on_checkout() { + return 'Have a Promo Code?' . ' ' . __( 'Click here to enter your code', 'woocommerce' ) . ''; +} + +add_filter( 'woocommerce_checkout_coupon_message', 'woocommerce_rename_coupon_message_on_checkout' ); +// 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 = 'Promo Code'; + + } elseif ( 'Apply Coupon' === $text ) { + $translated_text = 'Apply Promo Code'; + } + return $translated_text; +} +add_filter( 'gettext', 'woocommerce_rename_coupon_field_on_checkout', 10, 3 ); + add_filter( 'woocommerce_billing_fields', 'remove_billing_fields', 20 ); add_action( 'woocommerce_thankyou', 'tracking_pixels' ); add_filter( 'woocommerce_thankyou_order_received_text', 'content_text', 10, 2 );