Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide Coupon notice form in Woocommerce checkout page

On my website the checkout page containing "Have a coupon? Click here to enter your code" box. I don't want this field on checkout page.I applying coupon via URl. I want to remove this box from checkout page by CSS. I attached the screenshot of that box in my checkout page. enter image description here

Is this possible?

I have already tried this:

function hide_coupon_field_on_checkout( $enabled ) {
    if ( is_checkout() ) {
        $enabled = false;
    }
    return $enabled;
}
add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_field_on_checkout' );

But it disable coupons functionality in checkout page.

Any help will be appreciated.

like image 704
developerme Avatar asked Dec 05 '25 14:12

developerme


1 Answers

You can use a custom function hooked in woocommerce_before_checkout_form action hook that will remove the notice coupon form without disabling coupon functionality in checkout page:

add_action( 'woocommerce_before_checkout_form', 'remove_checkout_coupon_form', 9 );
function remove_checkout_coupon_form(){
    remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );
}

Code goes in function.php file of the active child theme (or active theme).

Tested and works.

like image 55
LoicTheAztec Avatar answered Dec 08 '25 02:12

LoicTheAztec



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!