Magento 2 how to get custom attribute title and its value in phtml file.
Magento 2 – Get Custom Attribute Title and Value in phtml File
custom-attributesfrontendmagento2
custom-attributesfrontendmagento2
Magento 2 how to get custom attribute title and its value in phtml file.
Best Answer
As per your comments, I assume that you are getting the product object.
Then use:
This will give the attribute object, where
attribute_code
is the attribute code.then use the following code to get the value of attribute for current product:
and use below code to get the name (label) of the attribute: