Hide Coupon Field on Cart and Checkout
Disables the coupon entry field on both the cart and checkout pages to prevent discount hunting while keeping WooCommerce coupon functionality intact for admin-applied coupons.
PHPby SnipCraft
php
<?php
if ( ! class_exists( 'WooCommerce' ) ) {
return;
}
// Hide the coupon form on the cart page.
add_filter( 'woocommerce_cart_show_coupon', '__return_false' );
// Hide the coupon toggle link on the checkout page.
add_filter( 'woocommerce_checkout_show_terms', '__return_true' ); // unrelated, keep terms
add_filter( 'woocommerce_checkout_coupon_message', '__return_empty_string' );
// Remove the cart coupon action entirely.
add_action( 'woocommerce_cart_coupon', 'scseed_remove_cart_coupon_form', 0 );
function scseed_remove_cart_coupon_form() {
remove_action( 'woocommerce_cart_coupon', 'woocommerce_cart_coupon' );
}#cart#checkout#coupon#ux#woocommerce