fix(types,utils,promotion): Move from total to original_total to resolve edge case for adjustments calculation (#13106)
* Move from total to original_total to resolve edge case in adjustment calculation * Added changeset * Added test case for correction --------- Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
@@ -110,7 +110,7 @@ function applyPromotionToItems(
|
||||
MathBN.sub(
|
||||
MathBN.add(
|
||||
acc,
|
||||
promotion.is_tax_inclusive ? item.total : item.subtotal
|
||||
promotion.is_tax_inclusive ? item.original_total : item.subtotal
|
||||
),
|
||||
appliedPromotionsMap.get(item.id) ?? 0
|
||||
),
|
||||
@@ -124,7 +124,10 @@ function applyPromotionToItems(
|
||||
|
||||
for (const item of applicableItems) {
|
||||
if (
|
||||
MathBN.lte(promotion.is_tax_inclusive ? item.total : item.subtotal, 0)
|
||||
MathBN.lte(
|
||||
promotion.is_tax_inclusive ? item.original_total : item.subtotal,
|
||||
0
|
||||
)
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user