OFBIZ-13269: Add support for maximum discount cap in Cart Range Percent Discount promotions#910
Draft
diveshdut wants to merge 9 commits intoapache:trunkfrom
Draft
OFBIZ-13269: Add support for maximum discount cap in Cart Range Percent Discount promotions#910diveshdut wants to merge 9 commits intoapache:trunkfrom
diveshdut wants to merge 9 commits intoapache:trunkfrom
Conversation
…shdut/codex/add-maximum-discount-cap-for-promotions Add max discount cap for cart percent promotions
|
Contributor
|
Hi @diveshdut, Is this PR still a draft? TIA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Introduced a new
maxDiscountAmountfield inProductPromoActionto configure a ceiling for percentage-based cart discounts. This ensures that the applied discount never exceeds the configured maximum, regardless of cart total value.Updated
ProductPromoActionServices.groovyto enforce this limit during promotion calculation. Also added UI support to allow users to set the maximum discount amount when configuring promotions.Problem
Currently, when configuring a Cart Range Percent Discount in promotions, OFBiz applies the discount percentage across the cart total without any ceiling.
This creates issues for high-value carts where the discount amount may become disproportionately large.
For example, with a 15% discount on cart total, a $2000 cart would result in a $300 discount. Many businesses want the flexibility to cap such discounts at a fixed value (e.g., $100), irrespective of cart size.
Solution:
2.1) Apply the percentage discount as usual.
2.2) Validate against the configured maximum.
2.3) Enforce the ceiling if the computed discount exceeds maxDiscountAmount.
Notes: