<?php | |
// hide coupon field on cart page | |
function hide_coupon_field_on_cart( $enabled ) { | |
if ( is_cart() ) { | |
$enabled = false; | |
} | |
return $enabled; | |
} | |
add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_field_on_cart' ); | |
// hide coupon field on checkout page | |
function hide_coupon_field_on_checkout( $enabled ) { | |
if ( is_checkout() ) { | |
$enabled = false; | |
} | |
return $enabled; | |
} | |
add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_field_on_checkout' ); |
This comment has been minimized.
This comment has been minimized.
In your function.php (in theme folder) |
This comment has been minimized.
This comment has been minimized.
Anyone see a hook for hiding it from a specific user role? I have Pro MUA as a user role and I need to hide the coupon from them. I added the following but it's not working `function woo_get_user_role() { function hide_coupon_field_on_cart( $enabled ) { |
This comment has been minimized.
This comment has been minimized.
Works a treat! Just make sure to remove the first line |
This comment has been minimized.
This comment has been minimized.
Thanks ;) |
This comment has been minimized.
This comment has been minimized.
I have a problem. I've placed this code and everything seems to work fine. |
This comment has been minimized.
This comment has been minimized.
just want to ask to be sure: It would be best to create a child theme for woocommerce for the cart and/or checkout pages and then put this code in the functions.php of those themes, correct? |
This comment has been minimized.
This comment has been minimized.
Ah, very nice piece of code. Thanks! |
This comment has been minimized.
This comment has been minimized.
Very Nice code |
This comment has been minimized.
This comment has been minimized.
Hello, i have a question. i configured a rule on my woocomerce->coupon (for example apply a coupon discount when min spend is 27$). Now when I want to pay the bill, always appear: do you have any coupon? please enter the code....... Then i only want that this message appear only when the bill is >27$. How can i do it? |
This comment has been minimized.
This comment has been minimized.
thanks |
This comment has been minimized.
This comment has been minimized.
thank you. works great on checkout! |
This comment has been minimized.
This comment has been minimized.
Thanks - this still works with Woocommerce 3.4 and Wordpress 4.9.6 :) |
This comment has been minimized.
This comment has been minimized.
What if my checkout and cart on the same page, and i want hide it only on checkout? what code i can use? |
This comment has been minimized.
This comment has been minimized.
@TGurgen, use And |
This comment has been minimized.
This comment has been minimized.
Works great as of Jan. 2020! |
This comment has been minimized.
This comment has been minimized.
I have woocommerce site running woocommerce memberships and I am trying to disable to coupon entry box in both the cart and checkout for members only. Non members should still see the coupon entry box and be able to use coupons, but people with a membership should not see it at all.I want to do this with a code snippet. Anyone can help me ? |
This comment has been minimized.
This comment has been minimized.
Works perfectly. Kudos |
This comment has been minimized.
where do I add this?