How can i display an attribute under the title in magento 2.2.5 enter image description here


Add the snippet of code below to the following file in your custom theme:


<referenceContainer name="columns.top">
      <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.customattribute" template="Magento_Catalog::product/view/attribute.phtml" after="product.main.title">
                  <argument name="at_call" xsi:type="string">{at call goes here e.g. getCustomAtribute}</argument>
                  <argument name="at_code" xsi:type="string">{attribute code goes here}</argument>
                  <argument name="at_label" xsi:type="string">default</argument>
                  <argument name="add_attribute" xsi:type="string">itemprop="{attribute code goes here}"</argument>

Then flush your caches and the attribute should appear.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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