[Enhancement]: Add a filter for the items to apply coupons array. #45790
Labels
focus: coupon
Issues related to coupons.
team: Proton
type: enhancement
The issue is a request for an enhancement.
Describe the solution you'd like
I am working on an issue where fixed_cart coupon needs to be applied to only a subset of the cart items. The items to apply coupon array is built by
get_items_to_apply_coupon
method in WC_Discounts class.I propose a filter in
get_items_to_apply_coupon
modify the items to apply coupons to.Describe alternatives you've considered
I initially noticed that
$coupon->is_valid_for_product
is called to check whether to exclude an item so I attempted usingwoocommerce_coupon_is_valid_for_product
filter, but that's not enough because the exclusion only applies to non-cart coupon.Additional context
No response
The text was updated successfully, but these errors were encountered: