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>
asked Jan 31, 2017 at 7:33
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

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>
answered Jan 31, 2017 at 9:26
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.