Fix issue on fixed total amount discount when using includes tax (#3472)
The calculation of the fixed discount amount breaks when having includes_tax setting active, due to the line item totals are incorrect and returning everything as 0, thus the totalItemPercentage will be Infinitiy due to the division by a subtotal of 0
This commit is contained in:
committed by
GitHub
parent
9ceddf45a9
commit
3bf73e388a
@@ -634,12 +634,9 @@ class DiscountService extends TransactionBaseService {
|
||||
})
|
||||
|
||||
let fullItemPrice = lineItem.unit_price * lineItem.quantity
|
||||
if (
|
||||
this.featureFlagRouter_.isFeatureEnabled(
|
||||
TaxInclusivePricingFeatureFlag.key
|
||||
) &&
|
||||
lineItem.includes_tax
|
||||
) {
|
||||
const includesTax = this.featureFlagRouter_.isFeatureEnabled(TaxInclusivePricingFeatureFlag.key) && lineItem.includes_tax
|
||||
|
||||
if (includesTax) {
|
||||
const lineItemTotals = await this.newTotalsService_
|
||||
.withTransaction(transactionManager)
|
||||
.getLineItemTotals([lineItem], {
|
||||
@@ -664,6 +661,7 @@ class DiscountService extends TransactionBaseService {
|
||||
const totals = await this.newTotalsService_.getLineItemTotals(
|
||||
discountedItems,
|
||||
{
|
||||
includeTax: includesTax,
|
||||
calculationContext,
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user