Magento – remove attribute set

As you probably know (or should know) Magento uses EAV attribute db organization. Its not pretty, its not fast but we need to live with it 🙂

When your site admins work their ecommerce magic they will need to insert products. And most probably they will (at least when they start the process) play around with product attributes and attribute sets.

A client of mine was able to insert 50 attribute sets at the beginning. After one year most of the products belong to one attribute set and other 49 had only one or two products linked to it.

So it was time for cleaning. Unfortunately Magento does not allow to remove attribute set out of administration. We need to write a script for it …

First we need to find appropriate tables that have information about attribute sets linked.


If you check out the table you will find all your custom attribute sets in it with defaut ones as well. Please take notice of entity_type_id. Since we are cleaning product attribute sets, we will only work with entity type == 10. Check this in your own DB before using it!!!

Write down all attribute_set_ids you want to remove and put it in an array.


I exported all products that are still linked to attribute sets that are going to be removed and handed the CSV list to my client. Store managers then had to clean products (insert them under new attribute set or remove them if they were not in use). With this I accomplished pruned catalog and spared some time on coding.


So we have attribute set and we have products linked to it. But how attributes are linked to attribute set is still missing. This information is stored in eav_attribute_group table. However since its a foreign key in innodb table and cascade delete is set we don’t need to worry about this one.


Programatically remove attribute set in Magento


Leave a Reply

Your email address will not be published. Required fields are marked *

Please prove me that you are not spamer :) * Time limit is exhausted. Please reload CAPTCHA.