I wanted to do something different on my own checkout page, and change the default “Have a Coupon?” message. Thankfully, WooCommerce gives us a filter we can use to accomplish anything we like – such as adding a FontAwesome icon or changing the text string completely!

WooCommerce: editing "Have a Coupon?" message @ checout
WooCommerce: editing "Have a Coupon?" message @ checout WooCommerce: editing “Have a Coupon?” message @ checout

PHP snippet: Change “Have a Coupon?” Message @ WooCommerce Checkout


/**
 * @snippet       Edit "Have a Coupon" message @ WooCommerce Checkout
 * @how-to        Get CustomizeWoo.com FREE
 * @sourcecode    https://businessbloomer.com/?p=21348
 * @author        Rodolfo Melogli
 * @testedwith    WooCommerce 2.6.8, WordPress 4.7
 */

add_filter( 'woocommerce_checkout_coupon_message', 'bbloomer_have_coupon_message');

function bbloomer_have_coupon_message() {
return '<i class="fa fa-ticket" aria-hidden="true"></i> Have a coupon? <a href="#" class="showcoupon">Click here to enter your discount code</a>';
}

Share:

Leave a Reply