Magento2: Tier price percentage incorrect if special price set

Created on 7 Oct 2016  路  5Comments  路  Source: magento/magento2

Preconditions

  1. I'm running Magento 2.1.1 on hypernode-vagrant environment, however the issue also occurs on our production server (also Magento 2.1.1)
  2. Environment runs on PHP7

Steps to reproduce

  1. I have the Configuration > Catalog > Price > Catalog Price Scope setting set to Website
  2. I have set TAX settings to show prices including VAT (21% in The Netherlands).
  3. I have a simple product with an original price of 37.50 euro
  4. The special price for this product is 28.75 euro
  5. Added two tiers:
    quantity: 2, price: 28.25 euro
    quantity: 3, price: 27.75 euro

Expected result

Tier prices should:
Buy 2 for 28.25 euro and save 25% (which is 100% - (28.25/37.50))
Buy 3 for 27.75 euro and save 26% (which is 100% - (27.75/37.50))

Actual result

Tier prices show:
Buy 2 for 28.25 euro and save 19%
Buy 3 for 27.75 euro and save 21%

With a special price set the calculation of the percentage uses the special price + VAT as the original price. In this case 100% - (28.25 / (28.75 + 21%)) ~ 19%

Tax Format is valid Ready for Work bug report non-issue

All 5 comments

Thank you for your bug report.
Internal Jira Ticket MAGETWO-59828 is created.

trying to solve a Magento 2.1.2 bug this is what I did:

public function getSavePercent(AmountInterface $amount)
{
    $tax = $amount->getAdjustmentAmounts();
    $sumarTax = $tax['tax'];
    return ceil(
        100 - ((100 / $this->priceInfo->getPrice(FinalPrice::PRICE_CODE)->getValue())
            * ($amount->getBaseAmount() + $sumarTax))
    );
}

It works until they found a right solution

What is the state of this issue?

@johnvanderstelt thank you for report. Closing the issue as won't fix. it is expected behavior

@magento-engcom-team well, https://github.com/magento/magento2/commit/499e95175933ee5d954591475024fd784f74d984 looks like there was a fix in 2.2.x actually.

@vesvello looks like the fix was to replace $amount->getBaseAmount() with $amount->getValue() which is a bit different to your version but probably gives the same result.

Was this page helpful?
0 / 5 - 0 ratings