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

original_price not calculated correctly due to tax bug #463

@didkan

Description

@didkan

Issue:
If config.tax.sourcePriceIncludesTax is set to true it is never honored when calculating prices due to a bug in platform tax code. There are however some specific prerequisites for this bug to show.
The result of this bug is that original_price, original_price_incl_tax etc will be calculated wrong before sent off to VueStorefront.

Prerequisites:

  • Multistore setup (config.storeViews.multistore: true)
  • config.storeViews.xx.sourcePriceIncludesTax is not set at all
  • config.tax.sourcePriceIncludesTax set to true

The bug is here:
https://github.com/DivanteLtd/vue-storefront-api/blob/29d4ce5998724610f6023275e08dbcc37f802caf/src/platform/magento2/tax.js#L41-L46

When config.storeViews.xx.sourcePriceIncludesTax does not exist in a multistore setup the variable sourcePriceInclTax is set to undefined. The problem is that in the referenced code snippet the variable is tested strictly against null which will give a false negative.

Solution:
Use normal equality operator instead of strict equality operator since it will catch both null and undefined values.
eg. (sourcePriceInclTax == null) instead of (sourcePriceInclTax === null)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions