Skip to content

Commit

Permalink
#6882 Fix discount applying when tax included in price
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanovM committed Oct 12, 2023
1 parent 205e65c commit 52fc0f4
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,7 @@ protected virtual int ConvertAmountToRewardPoints(decimal amount)
(discountAmountExclTax, appliedDiscounts) = await GetOrderSubtotalDiscountAsync(customer, subTotalWithoutDiscountExclTax);
if (subTotalWithoutDiscountExclTax < discountAmountExclTax)
discountAmountExclTax = subTotalWithoutDiscountExclTax;
discountAmountInclTax = discountAmountExclTax;

//subtotal with discount (excl tax)
subTotalWithDiscountExclTax = subTotalWithoutDiscountExclTax - discountAmountExclTax;
Expand All @@ -927,7 +928,7 @@ protected virtual int ConvertAmountToRewardPoints(decimal amount)
if (subTotalWithoutDiscountExclTax > decimal.Zero)
{
var discountTax = taxRates[taxRate] * (discountAmountExclTax / subTotalWithoutDiscountExclTax);
discountAmountInclTax = discountAmountExclTax + discountTax;
discountAmountInclTax += discountTax;
taxValue = taxRates[taxRate] - discountTax;
if (_shoppingCartSettings.RoundPricesDuringCalculation)
taxValue = await _priceCalculationService.RoundPriceAsync(taxValue);
Expand Down

0 comments on commit 52fc0f4

Please sign in to comment.