<?php
// hide coupon form from the cart and checkout pages if there's a deposit product in the cart
function hide_coupon_field( $enabled ) {
if ( is_cart() || is_checkout() ) {
if ( class_exists( 'WC_Deposits_Cart_Manager' ) ) {
if ( WC_Deposits_Cart_Manager::has_deposit() ) {
$enabled = false;
}
}
}
return $enabled;
}
add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_field' );