Skip to content
This repository was archived by the owner on May 28, 2023. It is now read-only.

Commit ba1b58f

Browse files
author
tkostuch
committed
pass finalPriceInclTax for calculation
1 parent 20cdc83 commit ba1b58f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

config/default.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@
144144
"setConfigurableProductOptions": true,
145145
"sourcePriceIncludesTax": false,
146146
"deprecatedPriceFieldsSupport": true,
147-
"finalPriceIncludesTax": true,
147+
"finalPriceIncludesTax": false,
148148
"userGroupId": null,
149149
"useOnlyDefaultUserGroupId": false
150150
},

src/lib/taxcalc.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ function assignPrice ({ product, target, price = 0, tax = 0, deprecatedPriceFiel
6666
}
6767

6868
export function updateProductPrices ({ product, rate, sourcePriceInclTax = false, deprecatedPriceFieldsSupport = false, finalPriceInclTax = true }) {
69+
console.log(finalPriceInclTax)
6970
const rate_factor = parseFloat(rate.rate) / 100
7071
const hasOriginalPrices = (
7172
product.hasOwnProperty('original_price') &&
@@ -170,15 +171,15 @@ export function calculateProductTax ({ product, taxClasses, taxCountry = 'PL', t
170171
if (taxClass) {
171172
for (let rate of taxClass.rates) { // TODO: add check for zip code ranges (!)
172173
if (rate.tax_country_id === taxCountry && (rate.region_name === taxRegion || rate.tax_region_id === 0 || !rate.region_name)) {
173-
updateProductPrices({ product, rate, sourcePriceInclTax, deprecatedPriceFieldsSupport })
174+
updateProductPrices({ product, rate, sourcePriceInclTax, deprecatedPriceFieldsSupport, finalPriceInclTax })
174175
rateFound = true
175176
break
176177
}
177178
}
178179
}
179180
}
180181
if (!rateFound) {
181-
updateProductPrices({ product, rate: {rate: 0}, sourcePriceInclTax, deprecatedPriceFieldsSupport })
182+
updateProductPrices({ product, rate: {rate: 0}, sourcePriceInclTax, deprecatedPriceFieldsSupport, finalPriceInclTax })
182183

183184
product.price_incl_tax = product.price
184185
product.price_tax = 0

0 commit comments

Comments
 (0)