-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Open
Labels
Area: APIsComponent: ApiUse with concrete module component label E.g. "Component: Api" + "Catalog"Use with concrete module component label E.g. "Component: Api" + "Catalog"Issue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P3May be fixed according to the position in the backlog.May be fixed according to the position in the backlog.Progress: ready for groomingReported on 2.4.xIndicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchThe issue has been reproduced on latest 2.4-develop branch
Description
Preconditions and environment
- Magento 2
Steps to reproduce
1. Create new cart price rules with the following configuration
Rule 1:
Rule Name: 10% Fix Discount
Coupon: No Coupon
Conditions: Apply for all product
Action:
Apply: Percent of product price discount
Discount Amount: 10
Rule 2:
Rule Name: 3% Fix Discount
Coupon: No Coupon
Conditions: Apply for all product
Action:
Apply: Percent of product price discount
Discount Amount: 3
- Order product with price = $12
- Query REST endpoint
orders/{id}for this order
Expected result
In API response receive discount_percent equals 12.7
Actual result
In API response receive discount_percent equals 13
Additional information
Magento2 REST api for orders has one field for discount_percent. In case when order has multiple discounts they are just added. This results in incorrect calculation.
e.g.
order amount 12. discount1 = 10%, discount2 = 3%.
How magento2 does calculation:
12 - (12 * 0.1) = 10.8 // calculate 10%
10.8 - (10.8 * 0.03) = 10.476 // next calculate 3%
12 - 10.476 = 1.524 // total discount
But if API response is used to calculate discount - it will result in wrong discount amount:
12 - (12 * 0.13) = 10.44 // calculate 13% provided by API field `discount_percent`
12 - 10.44 = 1.56 // total discount is different
The correct discount_percent in this case would be 12.7:
12 - (12 * 0.127) = 10.476
12 - 10.476 = 1.524 // correct discount amount
Is it possible to change logic behind discount_percent field in REST API response in case of multiple discounts?
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
Area: APIsComponent: ApiUse with concrete module component label E.g. "Component: Api" + "Catalog"Use with concrete module component label E.g. "Component: Api" + "Catalog"Issue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P3May be fixed according to the position in the backlog.May be fixed according to the position in the backlog.Progress: ready for groomingReported on 2.4.xIndicates original Magento version for the Issue report.Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchThe issue has been reproduced on latest 2.4-develop branch