@@ -20,7 +20,7 @@ function isSpecialPriceActive (fromDate, toDate) {
2020 }
2121}
2222
23- export function updateProductPrices ( product , rate , sourcePriceInclTax = false , deprecatedPriceFieldsSupport = false , finalPriceInclTax = true ) {
23+ export function updateProductPrices ( { product, rate, sourcePriceInclTax = false , deprecatedPriceFieldsSupport = false , finalPriceInclTax = true } ) {
2424 const rate_factor = parseFloat ( rate . rate ) / 100
2525 if ( finalPriceInclTax ) {
2626 product . final_price_incl_tax = parseFloat ( product . final_price ) // final price does include tax
@@ -206,11 +206,11 @@ export function updateProductPrices (product, rate, sourcePriceInclTax = false,
206206 }
207207}
208208
209- export function calculateProductTax ( product , taxClasses , taxCountry = 'PL' , taxRegion = '' , sourcePriceInclTax = false , deprecatedPriceFieldsSupport = false , finalPriceInclTax = true , userGroupId = null , _storeConfigTax ) {
209+ export function calculateProductTax ( { product, taxClasses, taxCountry = 'PL' , taxRegion = '' , sourcePriceInclTax = false , deprecatedPriceFieldsSupport = false , finalPriceInclTax = true , userGroupId = null , isTaxWithUserGroupIsActive } ) {
210210 let rateFound = false
211211 if ( product . tax_class_id > 0 ) {
212212 let taxClass
213- if ( checkIfTaxWithUserGroupIsActive ( _storeConfigTax ) && typeof userGroupId === 'number' ) {
213+ if ( isTaxWithUserGroupIsActive ) {
214214 taxClass = taxClasses . find ( ( el ) =>
215215 el . product_tax_class_ids . indexOf ( parseInt ( product . tax_class_id ) ) >= 0 &&
216216 el . customer_tax_class_ids . indexOf ( userGroupId ) >= 0
@@ -222,15 +222,15 @@ export function calculateProductTax (product, taxClasses, taxCountry = 'PL', tax
222222 if ( taxClass ) {
223223 for ( let rate of taxClass . rates ) { // TODO: add check for zip code ranges (!)
224224 if ( rate . tax_country_id === taxCountry && ( rate . region_name === taxRegion || rate . tax_region_id === 0 || ! rate . region_name ) ) {
225- updateProductPrices ( product , rate , sourcePriceInclTax , deprecatedPriceFieldsSupport )
225+ updateProductPrices ( { product, rate, sourcePriceInclTax, deprecatedPriceFieldsSupport } )
226226 rateFound = true
227227 break
228228 }
229229 }
230230 }
231231 }
232232 if ( ! rateFound ) {
233- updateProductPrices ( product , { rate : 0 } )
233+ updateProductPrices ( { product, rate : { rate : 0 } } )
234234
235235 product . price_incl_tax = product . price
236236 product . price_tax = 0
0 commit comments