0

i have created custom attribute for ex. color in magento 2.1 but i can't able to display it in product view page frontend. so please guide me how to achieve this in the new version.

getAttributeText('color') this works in Magento 2.0.1 to Magento 2.0.7 but not working in Magento 2.1.

1 Answer 1

1

In product view or product details page you can display like this.

..............................

$attribute = $this->getProduct()->getResource()->getAttribute('color');
if ($attribute)
{
    $color_value = $attribute ->getFrontend()->getValue($this->getProduct());
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.