5

Need help with Magento2. Anyone know how to override Magento Tier Price. Actually i am developing an extension and stuck here.

2
  • What you mean 'overwrite'? Please describe more what you need.
    – KAndy
    Commented Oct 2, 2015 at 5:09
  • I want to display customized tier price block in place of default tier price block. It means I want to display Tier Price in drop down not in label. Commented Oct 2, 2015 at 5:12

2 Answers 2

2

Tier Price is displayed in below template

Magento/Catalog/view/base/templates/product/price/tier_prices.phtml

First, you need copy this template to own extension.

Second, you need add layout update with name catalog_product_prices to overwrite base template.

<referenceBlock name="render.product.prices">
    <arguments>
        <argument name="default" xsi:type="array">
            <item name="prices" xsi:type="array">
                <item name="tier_price" xsi:type="array">
                    <item name="render_template" xsi:type="string">[Vendor]_[ModuleName]::product/price/tier_prices.phtml</item>
                </item>
             </item>
       </argument>
    </arguments> 
</referenceBlock>

And last one, modify template as you need.

2
  • 1
    Not working :( Stil it calls default file (Magento/Catalog/view/base/templates/product/price/tier_prices.phtml) Commented Oct 2, 2015 at 9:54
  • Do you add sequence on Magento_Catalog to you module.xml?
    – KAndy
    Commented Apr 25, 2016 at 11:51
0

The top answer here by KAndy should work as long as you use a referenceBlock instead of blockReference.

Your Answer

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

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