I have created a counfigurable product with. New Attribute Set & it's attributes. I have set the value in Admin also.

On vendor\magento\module-catalog\view\frontend\templates\product\list.phtml

I'm customizing listing. I'm trying to get my newly added attribute using

foreach ($_productCollection as $_product):
    echo $_helper->productAttribute($_product, $_product->getYear(), 'year');

    $attribute = $_product->getResource()->getAttribute('year');
    if ($attribute) {
        echo $labelValue = $attribute->getFrontend()->getValue($_product);

But it's still not displaying set value. I'm able to see value in Admin Product Page. But not in the frontend.

I have cleared cache as well.

2 Answers 2


0 down vote Replace below code :

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

to my Code

$_attributeValue =$_product->getResource()->getAttribute('year')->getFrontend()->getValue($_product);

remove your Code use my code only one you have to use this will work

After Editing the code run the below command:

php bin/magento cache:flush` & `php bin/magento cache:clean
  • Hi @Ankit By applying this it only display 'No' as a value for some not 2 all.
    – Jackson
    Sep 27, 2016 at 1:47
  • It's working fine on Product Detail Page, but not in Listing
    – Jackson
    Sep 27, 2016 at 3:21
  • 1
    @Ankit Shah : what is your Catalog Input Type for Store Owner : In my case i checked with Text field Attribute its working fine also you have to set Under Strore Front while creating Attribute : Visible on Catalog Pages on Storefront => Yes screencast.com/t/htGirHZ4OcO . If you created drop down attribute then only your value is showing No this is because you have not selected Yes . so by default it will show No
    – Brad Hodge
    Sep 27, 2016 at 4:39
  • 1
    Hi @Ankit:- It's missing Used in Product Listing to Yes which is set now :)
    – Jackson
    Sep 27, 2016 at 4:52
  • So to display your Custom/Newly created Attribute on Frontend Allow HTML Tags on Storefront,Visible on Catalog Pages on Storefront, Used in Product Listing set to be Yes
    – Jackson
    Sep 27, 2016 at 4:58

Edit the attribute, under Storefront Properties tab make sure you have set Used in Product Listing to "Yes". Otherwise you won't be able to get it's value in list.phtml. Then you can use


for text fields or


for dropdowns or multi select fields.


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.