Magento – product attribute

Get attribute collection:


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

Get attribute type:


$attribute->getAttributeType();

Get attribute Label:


$attribute->getFrontendLabel();

Get attribute default value:


$attribute->getDefaultValue();

Check if the attribute is visible:


$attribute->getIsVisible();

Check if the attribute is required:


$attribute->getIsRequired();

1 comment

Leave a Reply

Your email address will not be published. Required fields are marked *