7

I want to add static text above the price. I tried to add as explained in the thread (Magento 2: How to add text within container via XML) but it didn't work for me.

<referenceContainer name="product.info.main">
    <block class="Magento\Catalog\Pricing\Render" name="product.price.final" before="product.price.tier">
        <arguments>
            <argument translate="true" name="text" xsi:type="string">Mytext</argument>
            <argument name="price_render" xsi:type="string">product.price.render.default</argument>
            <argument name="price_type_code" xsi:type="string">final_price</argument>
            <argument name="zone" xsi:type="string">item_view</argument>
        </arguments>
    </block>
</referenceContainer>
2
  • have you tried <action> tag ? Jan 31, 2017 at 9:04
  • yes but that also doesnt work.
    – Jarnail S
    Jan 31, 2017 at 9:18

1 Answer 1

3

This would add your static text block above the price.

<referenceContainer name="product.info.main">
    <block class="Magento\Framework\View\Element\Text" name="your.block.name" before="product.info.price">
        <arguments>
            <argument name="text" xsi:type="string"><![CDATA[<div>Content of your block.</div>]]></argument>
        </arguments>
    </block>
</referenceContainer>
0

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.