June 4, 2019
WooCommerce: Hide Coupon On Checkout If Already Exists
This code will disable coupon on cart if it’s already applied.
//Disable coupon on cart if already exists add_filter( 'woocommerce_coupons_enabled', 'woocommerce_coupons_enabled_checkout' ); function woocommerce_coupons_enabled_checkout( $coupons_enabled ) { global $woocommerce; if ( ! empty( $woocommerce->cart->applied_coupons ) ) { remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 ); return false; } return $coupons_enabled; }