How to Delete Custom Attribute Programmatically?

Sometimes you have created custom attribute but due to some reason you need to delete that attribute. To delete attribute programmatically you need to create a different upgrade script.

If the install script has the version 0.1.0 create the file upgrade-0.1.0-0.1.1.php with the following content.

$installer = $this;
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->removeAttribute('catalog_category', 'your_custom_attribute');

Then go to config.xml and change the version tag from 0.1.0 to 0.1.1.  

Now clear Magento cache and by refreshing the page check your changes.

If you face any problems or need our professional services, please email us at [email protected]

Join our Newsletter

Never miss the latest offers, voucher codes and useful articles delivered weekly in your inbox.