Magento – Magento 2: Display Custom attribute value under the product name on category page

attributescategorymagento-2.1.3magento2product-attribute

I want to display custom attribute value under the product name on category page.

Attribute type is dropdown and attribute name is Brand.

I want to display the brand name under the product name on category page in GRID and LIST mode.

How can i do that? What's the standard way to display brand name under product name?

Do i need to create any module for that or custom function?

Any help would be appreciated.

Best Answer

Edit below file

app/design/frontend/CUSTOM/THEME/Magento_Catalog/templates/product/list.phtml

$attribute = $_product->getResource()->getAttribute('attribute_code');

// Get Value

$attributeValue = $attribute->getFrontend()->getValue($_product);

// Get Label

$attributeLabel = $attribute->getStoreLabel();

Note: Make sure “Visible on Product View Page on Front-end” and “Used in Product Listing” options under storefront Properties are set to Yes.

Related Topic