Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- add disconnect and sync options for cart/clear - @gibkigonzo (#4062)
- add '1' as searched value for 'is_user_defined' and 'is_visible' (createAttributesListQuery) - @gibkigonzo (#4075)
- Fix possibility to add same SKU with different custom options to the cart - @Michal-Dziedzinski (#3595)
- Fix `calculateProductTax` to find matching tax rules from ES for current product - @DylannCordel (#4056)

## [1.11.1] - 2020.02.05

Expand Down
7 changes: 4 additions & 3 deletions core/modules/catalog/helpers/taxCalc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,16 @@ export function updateProductPrices ({ product, rate, sourcePriceInclTax = false

export function calculateProductTax ({ product, taxClasses, taxCountry = 'PL', taxRegion = '', sourcePriceInclTax = false, deprecatedPriceFieldsSupport = false, finalPriceInclTax = true, userGroupId = null, isTaxWithUserGroupIsActive }) {
let rateFound = false
if (product.tax_class_id > 0) {
let product_tax_class_id = parseInt(product.tax_class_id)
if (product_tax_class_id > 0) {
let taxClass
if (isTaxWithUserGroupIsActive) {
taxClass = taxClasses.find((el) =>
el.product_tax_class_ids.indexOf(parseInt(product.tax_class_id)) >= 0 &&
el.product_tax_class_ids.indexOf(product_tax_class_id) >= 0 &&
el.customer_tax_class_ids.indexOf(userGroupId) >= 0
)
} else {
taxClass = taxClasses.find((el) => el.product_tax_class_ids.indexOf(parseInt(product.tax_class_id) >= 0))
taxClass = taxClasses.find((el) => el.product_tax_class_ids.indexOf(product_tax_class_id) >= 0)
}

if (taxClass) {
Expand Down