Need help with Magento2. Anyone know how to override Magento Tier Price. Actually i am developing an extension and stuck here.
-
What you mean 'overwrite'? Please describe more what you need.– KAndyCommented 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.– Gaurav JainCommented Oct 2, 2015 at 5:12
Add a comment
|
2 Answers
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.
-
1Not working :( Stil it calls default file (Magento/Catalog/view/base/templates/product/price/tier_prices.phtml) Commented Oct 2, 2015 at 9:54
-
The top answer here by KAndy should work as long as you use a referenceBlock
instead of blockReference
.