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

Commit 7b29901

Browse files
authored
Merge pull request #380 from gibkigonzo/bugfix/add-tax-for-special_price
add tax to special_price
2 parents 9ec228e + 193a8b5 commit 7b29901

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
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 & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export function updateProductPrices ({ product, rate, sourcePriceInclTax = false
116116
// out of the dates period
117117
assignPrice({product, target: 'special_price', price: 0, tax: 0, deprecatedPriceFieldsSupport})
118118
} else {
119-
assignPrice({product, target: 'price', price: product.special_price, deprecatedPriceFieldsSupport})
119+
assignPrice({product, target: 'price', ...specialPriceWithTax, deprecatedPriceFieldsSupport})
120120
}
121121
} else {
122122
// the same price as original; it's not a promotion
@@ -170,15 +170,15 @@ export function calculateProductTax ({ product, taxClasses, taxCountry = 'PL', t
170170
if (taxClass) {
171171
for (let rate of taxClass.rates) { // TODO: add check for zip code ranges (!)
172172
if (rate.tax_country_id === taxCountry && (rate.region_name === taxRegion || rate.tax_region_id === 0 || !rate.region_name)) {
173-
updateProductPrices({ product, rate, sourcePriceInclTax, deprecatedPriceFieldsSupport })
173+
updateProductPrices({ product, rate, sourcePriceInclTax, deprecatedPriceFieldsSupport, finalPriceInclTax })
174174
rateFound = true
175175
break
176176
}
177177
}
178178
}
179179
}
180180
if (!rateFound) {
181-
updateProductPrices({ product, rate: {rate: 0}, sourcePriceInclTax, deprecatedPriceFieldsSupport })
181+
updateProductPrices({ product, rate: {rate: 0}, sourcePriceInclTax, deprecatedPriceFieldsSupport, finalPriceInclTax })
182182

183183
product.price_incl_tax = product.price
184184
product.price_tax = 0

0 commit comments

Comments
 (0)