0

I want to display when Add Tier price higher then regular (product)price display as working lower Tier price. If Is possible ? How Can Do it?

10
  • can u clear your question more Oct 8, 2018 at 6:59
  • Magento2: Tier price lower than regular price working fine but when set Tier price higher than regular price not display product view page working .. Oct 8, 2018 at 8:03
  • Magento always use lower price to display Oct 8, 2018 at 8:08
  • Thank you for response but is possible to display higher price to display? Oct 8, 2018 at 8:11
  • yes it is possible Oct 8, 2018 at 8:15

1 Answer 1

0

you have to rewrite below class for this

vendor/magento/module-catalog/Model/Product/Type/Price.php

create di.xml in your module and write below code

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\Catalog\Model\Product\Type\Price" type="[Vendor]\[Module]\Model\Product\Type\Price" />
</config>

and in your [Vendor]\[Module]\Model\Product\Type\Price

Override _applyTierPrice method change code to below

protected function _applyTierPrice($product, $qty, $finalPrice)
{
    if ($qty === null) {
        return $finalPrice;
    }

    $tierPrice = $product->getTierPrice($qty);
    if (is_numeric($tierPrice)) {
        $finalPrice = $tierPrice; //change this line from orignal code
    }
    return $finalPrice;
}
4
  • Thank you for your ans but still not display tier price like see screenshot prntscr.com/l3ikyi Oct 8, 2018 at 10:41
  • Not working for me as well. Mar 31, 2020 at 11:09
  • Anyone have a solution here ?
    – skm
    Apr 23, 2020 at 11:09
  • I am also struggling with this. May 3, 2021 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.