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?

  • can u clear your question more – Murtuza Zabuawala Oct 8 '18 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 .. – Vishal Baraiya Oct 8 '18 at 8:03
  • Magento always use lower price to display – Murtuza Zabuawala Oct 8 '18 at 8:08
  • Thank you for response but is possible to display higher price to display? – Vishal Baraiya Oct 8 '18 at 8:11
  • yes it is possible – Murtuza Zabuawala Oct 8 '18 at 8:15
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;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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