Hide Magento Attributes with no Value


Sometimes we come across a store that wants to have many different product attributes, but they only want the default attribute set. This means that every product will have lets say 10+ options that sometimes don’t apply to certain products. For instance a piece of clothing might need a size attribute, but a piece of furniture doesn’t. Because the store uses the same attribute sets for each products the empty size attribute will show up like this:


This is ofcourse very confusing for customers, so the better option would be to hide attribute value’s that are empty. This can be done with a small piece of code. Find and open the attributes.phtml file. This file can be found here:/app/design/frontend/default/[theme name]/template/catalog/product/view/attribute.phtml

Open the file and search for the following lines:

Replace the entire foreach loop with the following lines of code:

Thats it! Empty attributes will now be hidden from your product pages. Don’t forget to refresh your cache to see the changes.



  1. sakthibalan.a on

    Really Helpful, thanks a lot for this code. It changed the empty value disappeared from product attribute table.

  2. Working solution.

    But it would be better to override the getAdditionalData() in Mage_Catalog_Block_Product_View_Attributes. That way attributes which are not needed are not loaded (performance).

Leave A Reply