Magento 2 – Catalog – Useful Functions

Get Attribute Raw Value

/*@var \Magento\Catalog\Model\Product $product*/
$atributeValue = $product->getResource()->getAttributeRawValue($product->getId(),'your_attribute_code', null);

Get Attribute Text – for select/multiple select attributes

/*@var \Magento\Catalog\Model\Product $product*/
$atributeValue = $product->getAttributeText('your_attribute_code');

Leave a Reply

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