Implementing this feature is indeed a practical way to restrict the application of multiple coupons during the checkout process. This code will hide the coupon field on both the cart and checkout pages after a coupon is applied, effectively preventing customers from utilizing multiple coupons within a single transaction.
function ts_disable_coupon_field($enabled) { if (is_object(WC()->cart) && WC()->cart->applied_coupons) { if (is_cart() || is_checkout()) { $enabled = false; } } return $enabled; } add_filter('woocommerce_coupons_enabled', 'ts_disable_coupon_field');
Output
The output shows that, whenever a coupon is applied, the code tends to remove the coupon fields from both the cart and checkout pages. Thus restricting customers from applying an additional coupon or discount.
![](https://www.tychesoftwares.com/wp-content/uploads/2024/03/Hide-coupon-field-after-a-coupon-is-applied-in-cart-page-1024x582.png)
The following output shows that the coupon field is removed on the checkout page as well.
![](https://www.tychesoftwares.com/wp-content/uploads/2024/03/Hide-coupon-field-after-a-coupon-is-applied-in-checkout-page-1024x730.png)
The below output shows that the coupon field is not hidden when the code is not implemented. And by default, it allows as many coupons to be applied as well.
![](https://www.tychesoftwares.com/wp-content/uploads/2024/03/Coupon-field-not-hidden-and-allows-1024x636.png)
In the same way, the coupon field is not hidden in the checkout page too as shown below.
![](https://www.tychesoftwares.com/wp-content/uploads/2024/03/coupon-field-not-hidden-in-checkout-page-1024x753.png)
In the same way as above, you can also disable coupon fied when a bogo buy one get one is offered in WooCommerce.