First you have to load the products
$productCollection = $block->getLoadedProductCollection();
In the product listing page ,there will be a foreach loop for listing the products like this
foreach ($productCollection as $product)
Your code will be inside this loop.Place the below code at a place where ever you want to display the attribute label.
$product->getResource()->getAttribute('your_attribute_code')->getFrontend()->getValue($product);
$productCollection = $block->getLoadedProductCollection();
In the product listing page ,there will be a foreach loop for listing the products like this
foreach ($productCollection as $product)
Your code will be inside this loop.Place the below code at a place where ever you want to display the attribute label.
$product->getResource()->getAttribute('your_attribute_code')->getFrontend()->getValue($product);
Comments
Post a Comment