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

Wrong logic exporting product prices with tax excluded #43

Open
stephansteiner opened this issue Nov 14, 2023 · 3 comments
Open

Wrong logic exporting product prices with tax excluded #43

stephansteiner opened this issue Nov 14, 2023 · 3 comments

Comments

@stephansteiner
Copy link

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]
@stephansteiner
Copy link
Author

Furthermore, the function $this->systemConfig->isPriceInclTax() is a checking for a custom setting with key facebook_business_extension/catalog_management/price_incl_tax that is not visible in the Magento admin panel, because showInDefaults, showInWebsite and showInStore are all set to 0.

<field id="price_incl_tax" translate="label comment" type="select" sortOrder="50" showInDefault="0" showInWebsite="0" showInStore="0">
                    <label>Price Including Tax</label>
                    .....
</field>

Setting is not visible in Magento admin panel:
Bildschirmfoto 2023-11-14 um 06 53 11

@Bashev
Copy link

Bashev commented Nov 14, 2023

As workaround you can use:
php bin/magento config:set price_incl_tax 0

A lot of settings are hidden for some reason, probably after migration of the plugin from facebook to meta.

@stephansteiner
Copy link
Author

The setting is already set to 0.
The function isPriceInclTax returns a false value, the order of instructions is messed up.
If prices are set including taxes, then return as they are otherwise call getTaxPrice, right now it’s the other way around

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

2 participants