I need to get my Attribute code and it should be printed its values on details.phtml in my theme's template.
I have tried below but no luck.
$attribute = $_product->getResource()->getAttribute('identifier');
if ($attribute)
{
echo $attr_value = $attribute ->getFrontend()->getValue($_product);
}
Any other ideas to get this?
Best Answer
Please make sure Visible on Catalog Pages on Storefront Attribute option set as
Yes
.You can check this from backend
Stores >> Attributes - Products
. On Attribute Edit page, check theVisible on Catalog Pages on Storefront
option inStorefront Properties
Tab.