Skip to content

Wrong logic exporting product prices with tax excluded  #43

Open
@stephansteiner

Description

When exporting products in the feed that are set to excluding tax in the Magento admin panel, prices are exported without tax instead of with tax added.
Feed builder logic in app/code/Meta/Catalog/Model/Product/Tools is wrong:

$price = $this->systemConfig->isPriceInclTax()
             ? $this->catalogHelper->getTaxPrice($product, $product->getPrice(), true)
             : $product->getPrice();

If prices in Magento are set to "Catalog Prices" = "Excluding Tax" (Store > Configuration > Sales > Tax > Calculation Settings), the function call to
$this->systemConfig->isPriceInclTax()
will return false and the product price is exported as is.
Instead, it should return the price with taxed added.

The correct logic should be:

$price = $this->systemConfig->isPriceInclTax()
             ? $product->getPrice()
             : $this->catalogHelper->getTaxPrice($product, $product->getPrice(), true);

Found in functions getProductPrice() and getProductSalePrice().

Preconditions (*)

Steps to reproduce (*)

Expected result (*)

  1. [Screenshots, logs or description]

Actual result (*)

  1. [Screenshots, logs or description]

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