You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "diveshdut (via GitHub)" <gi...@apache.org> on 2025/09/12 12:58:45 UTC

[PR] OFBIZ-13269: Add support for maximum discount cap in Cart Range Percent Discount promotions [ofbiz-framework]

diveshdut opened a new pull request, #910:
URL: https://github.com/apache/ofbiz-framework/pull/910

   Introduced a new `maxDiscountAmount` field in `ProductPromoAction` to 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.groovy` to 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:
   
   1) Extended the ProductPromoAction entity with a new field: maxDiscountAmount.
   2) Enhanced the promotion calculation logic in ProductPromoActionServices.groovy to:
       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.
   3) Updated the promotion setup UI to allow administrators to configure this value.
   
   Notes:
   1) Applies only when a single promotion is active on the cart (no multiple promotion stacking considered).
   2) Keeps business configuration simple while addressing a common retail use case.
   3) Backward-compatible: existing promotions without maxDiscountAmount remain unaffected.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ofbiz.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OFBIZ-13269: Add support for maximum discount cap in Cart Range Percent Discount promotions [ofbiz-framework]

Posted by "diveshdut (via GitHub)" <gi...@apache.org>.
diveshdut closed pull request #910: OFBIZ-13269: Add support for maximum discount cap in Cart Range Percent Discount promotions
URL: https://github.com/apache/ofbiz-framework/pull/910


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ofbiz.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OFBIZ-13269: Add support for maximum discount cap in Cart Range Percent Discount promotions [ofbiz-framework]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #910:
URL: https://github.com/apache/ofbiz-framework/pull/910#issuecomment-3285201201

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_ofbiz-framework&pullRequest=910) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=910&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_ofbiz-framework&pullRequest=910&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_ofbiz-framework&pullRequest=910&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_ofbiz-framework&pullRequest=910&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_ofbiz-framework&pullRequest=910&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_ofbiz-framework&pullRequest=910)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ofbiz.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OFBIZ-13269: Add support for maximum discount cap in Cart Range Percent Discount promotions [ofbiz-framework]

Posted by "JacquesLeRoux (via GitHub)" <gi...@apache.org>.
JacquesLeRoux commented on PR #910:
URL: https://github.com/apache/ofbiz-framework/pull/910#issuecomment-3660320173

   Hi @diveshdut,
   
   Is this PR still a draft? TIA


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ofbiz.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OFBIZ-13269: Add support for maximum discount cap in Cart Range Percent Discount promotions [ofbiz-framework]

Posted by "diveshdut (via GitHub)" <gi...@apache.org>.
diveshdut commented on PR #910:
URL: https://github.com/apache/ofbiz-framework/pull/910#issuecomment-4126516763

   @JacquesLeRoux this PR can be merged if this looks good to you. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ofbiz.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OFBIZ-13269: Add support for maximum discount cap in Cart Range Percent Discount promotions [ofbiz-framework]

Posted by "JacquesLeRoux (via GitHub)" <gi...@apache.org>.
JacquesLeRoux commented on PR #910:
URL: https://github.com/apache/ofbiz-framework/pull/910#issuecomment-4127273069

   Thanks @diveshdut,
   
   I'll have a look as soon as I'll be available


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ofbiz.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org