On my website i want to display value of an attribute, but when i m trying to display, site goes blank. On my cart page i want to display details of my products feature Given below is the code to fetch all the attributes name

$attributes = $product->getAttributes();
foreach($attributes as $a)
    echo $a->getName()."\n";

I have written this code in default.phtml i m getting below output , i.e name of the attribute but i want the value of the attribute how to achieve it enter image description here

Tried methods $product->getAttributeText('features'); $a->getData();

1 Answer 1


$product->getAttributeText('features'); does only work for attributes of type "select".

$product->getData('features'); should do the trick.

  • Its not working for me. Sep 9, 2020 at 10:31
  • features is the attribute code? Is this attribute set to "visible in checkout" and "visible in product listing"? If not, try it. Sep 9, 2020 at 10:32
  • FYI $attribute->getFrontend()->getValue($product) worked for me Sep 14, 2020 at 19:40

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.