8

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 ? Commented Jan 31, 2017 at 9:04
  • yes but that also doesnt work. Commented Jan 31, 2017 at 9:18

1 Answer 1

4

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 you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.