1

I used

echo $_product->getColor()

but i will print code = 24 , instead of color name.

6

Try this :

$_product->getAttributeText('color');
| improve this answer | |
5

$_product->getColor() will return optionId not text so for Text use below code

If it is dropdown then right syntax for printing value is

$_product->getAttributeText('Attribute_code');

And In your case its $_product->getAttributeText('color');

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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