Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement]: Add a filter for the items to apply coupons array. #45790

Closed
rawdreeg opened this issue Mar 21, 2024 · 0 comments · Fixed by #45791
Closed

[Enhancement]: Add a filter for the items to apply coupons array. #45790

rawdreeg opened this issue Mar 21, 2024 · 0 comments · Fixed by #45791
Assignees
Labels
focus: coupon Issues related to coupons. team: Proton type: enhancement The issue is a request for an enhancement.

Comments

@rawdreeg
Copy link
Contributor

rawdreeg commented Mar 21, 2024

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 using woocommerce_coupon_is_valid_for_product filter, but that's not enough because the exclusion only applies to non-cart coupon.

Additional context

No response

@rawdreeg rawdreeg added the type: enhancement The issue is a request for an enhancement. label Mar 21, 2024
@rawdreeg rawdreeg self-assigned this Mar 21, 2024
@tammullen tammullen added focus: coupon Issues related to coupons. team: Proton labels Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: coupon Issues related to coupons. team: Proton type: enhancement The issue is a request for an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants