Do not allow coupons to be applied to product in backorder in WooCommerce

Do not allow coupons to be applied to products in backorder in WooCommerce on your child site.

Snippet Type

Execute on Child Sites

Snippet

function filter_woocommerce_coupon_get_discount_amount( $discount, $price_to_discount , $cart_item, $single, $coupon ) {    
    // On backorder
    if ( $cart_item['data']->is_on_backorder() ) {
        $discount = 0;
    }

    return $discount;
}
add_filter( 'woocommerce_coupon_get_discount_amount', 'filter_woocommerce_coupon_get_discount_amount', 10, 5 );
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.