MainWP Community

Hide the coupon box on the checkout page if the coupon is already applied in WooCommerce

Hide the coupon box on the checkout page if the coupon is already applied in WooCommerce on your child site.

Snippet Type

Execute on Child Sites

Snippet

add_filter( 'woocommerce_coupons_enabled', 'woocommerce_coupons_enabled_checkout' );

function woocommerce_coupons_enabled_checkout( $coupons_enabled ) {
    global $woocommerce;
    if ( ! empty( $woocommerce->cart->applied_coupons ) ) {
        return false;
    }
    return $coupons_enabled;
}