1

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

1

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

Magento_Catalog/layout/catalog_product_view.xml

<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">
              <arguments>
                  <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>
              </arguments>
      </block>
</referenceContainer>

Then flush your caches and the attribute should appear.

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.