Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TaxProxy calls calculateProductTax wrongly #24

Open
blackgearit opened this issue Jan 7, 2020 · 0 comments
Open

TaxProxy calls calculateProductTax wrongly #24

blackgearit opened this issue Jan 7, 2020 · 0 comments

Comments

@blackgearit
Copy link

I'm new with VSF and Shopware, I'm trying to set-up a dev environment.
I've noticed this error from api after shopware data-import to elastic, when i made a product search into the frontend:

vue-storefront-api    |     TypeError: Cannot read property 'tax_class_id' of undefined
vue-storefront-api    |     at Object.calculateProductTax (/var/www/src/lib/taxcalc.js:160:15)
vue-storefront-api    |     at TaxProxy.taxFor (/var/www/src/platform/shopware/tax.js:55:12)
vue-storefront-api    |     at /var/www/src/platform/shopware/tax.js:94:18
vue-storefront-api    |     at process._tickCallback (internal/process/next_tick.js:68:7)

and no items where listed in the results.

looking into vue-storefront-api/src/platform/shopware/tax.js (copied from shopware2vuestorefront/vsf-api-extension/tax.js)

  taxFor (product) {
    return calculateProductTax(product, this._taxClasses, this._taxCountry, this._taxRegion, this._sourcePriceInclTax)
  }

should be

taxFor (product) {
    return calculateProductTax({
      product: product,
      taxClasses: this._taxClasses,
      taxCountry: this._taxCountry,
      taxRegion: this._taxRegion,
      sourcePriceInclTax: this._sourcePriceInclTax
    })
  }

because the taxFor function's parameter is an object:
vue-storefront-api/src/lib/taxcalc.js

export function calculateProductTax ({ product, taxClasses, taxCountry = 'PL', taxRegion = '', sourcePriceInclTax = false, deprecatedPriceFieldsSupport = false, finalPriceInclTax = true, userGroupId = null, isTaxWithUserGroupIsActive }) {

After this change, the product search works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant