• Resolved Megunticook

    (@megunticook)


    I need to add some custom text next to the coupon field on the cart and checkout page. Basically just a note saying discounts can’t be combined.

    Is the only option to edit the template files? Or can I use a PHP function to do this with a hook or filter?

    Would love to leave the woo templates as they are so there aren’t complications when I update.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey @megunticook

    you can use this snippet to add some individual text

    add_filter( 'woocommerce_checkout_coupon_message', 'have_coupon_message');
     
    function have_coupon_message() {
    return '<i class="fa fa-ticket" aria-hidden="true"></i> Have a coupon? Discounts can′t be combined';
    }
    Thread Starter Megunticook

    (@megunticook)

    Thanks, unfortunately that code doesn’t seem to work either on the cart or checkout page–the text doesn’t show up.

    I’ll keep trying and will report back.

    Thread Starter Megunticook

    (@megunticook)

    My mistake–it works but it breaks the coupon form. After trying a bunch of different ideas in functions.php I ended up just copying 2 of my theme’s template files to my child theme folder and editing them.

    Not ideal but it works.

    Thanks again.

    Luminus Alabi

    (@luminus)

    Automattic Happiness Engineer

    Hey @megunticook,

    Glad to see you’ve got this working for you.

    I’ll go ahead and mark this as resolved now.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘adding custom text to the cart and checkout’ is closed to new replies.