Skip to content

Commit

Permalink
fix(core): Correctly calculate item price discount actions
Browse files Browse the repository at this point in the history
Was not taking into account existing promotions previously.
  • Loading branch information
michaelbromley committed Aug 20, 2020
1 parent 77284c3 commit 06bb780
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const discountOnItemWithFacets = new PromotionItemAction({
},
async execute(orderItem, orderLine, args) {
if (await facetValueChecker.hasFacetValues(orderLine, args.facets)) {
return -orderLine.unitPrice * (args.discount / 100);
return -orderItem.unitPriceWithPromotions * (args.discount / 100);
}
return 0;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const productsPercentageDiscount = new PromotionItemAction({

execute(orderItem, orderLine, args) {
if (lineContainsIds(args.productVariantIds, orderLine)) {
return -orderLine.unitPrice * (args.discount / 100);
return -orderItem.unitPriceWithPromotions * (args.discount / 100);
}
return 0;
},
Expand Down

0 comments on commit 06bb780

Please sign in to comment.