How to display custom attributes on Product Details page near product name?.

Here Manufacturer Name and Manufacturer Number is custom attributes. which value i want to show on Product Details page near product name.

enter image description here

Using this code view/frontend/layout/catalog_product_view.xml

<?xml version="1.0" encoding="UTF-8"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    <referenceBlock name="product.info.details">
        <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.demo" template="Custom_ProductAttribute::product/view/attribute.phtml" after="-">
                <argument name="at_call" xsi:type="string">getDemoLink</argument>
                <argument name="at_code" xsi:type="string">manufacturer_name</argument>
                <argument name="css_class" xsi:type="string">manufacturer_name</argument>
                <argument name="at_label" xsi:type="string">Manufacturer Name</argument>
                <argument name="add_attribute" xsi:type="string">itemprop="manufacturer_name"</argument>



 $manufacturerName = $_product->getResource()->getAttribute('manufacturer_name');
echo $manufacturerName->getFrontend()->getValue($_product);


enter image description here

1 Answer 1


You can use below code to display custom attribute on PDP

Manufacturer Name :

$manufacturerName = $_product->getResource()->getAttribute('manufacturer_name'); 
echo $manufacturerName->getFrontend()->getValue($_product);

Manufacturer No :

$manufacturerNo = $_product->getResource()->getAttribute('manufacturer_no'); 
echo $manufacturerNo->getFrontend()->getValue($_product);
  • I edit the question can you please check is it right?
    – Vivek
    Commented Feb 18, 2021 at 13:45
  • You have to add in .phtml not .xml Commented Feb 18, 2021 at 13:47
  • here i added view/frontend/templates/product/view/attribute.phtml
    – Vivek
    Commented Feb 18, 2021 at 13:47
  • Can you guide me steps please.
    – Vivek
    Commented Feb 18, 2021 at 13:48
  • 1
    Yes i understand but can you please share me steps please
    – Vivek
    Commented Feb 18, 2021 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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