I installed a module that added some product attributes but did not remove them on uninstall. Their existence is throwing errors. I expected a "delete attribute" button to be there when I click into the attribute, but the button is missing. What is the SQL to delete product attributes? THANKS

2 Answers 2


The way which I generally follow for these type of tasks is :
First create a test.php in magento root directory
Place below code there


    error_reporting(E_ALL | E_STRICT);

    require_once './app/Mage.php';

    $attr = 'test_remove'; //attribute code to remove

    $setup = Mage::getResourceModel('catalog/setup', 'core_setup');
    try {
        $setup->removeAttribute('catalog_product', $attr);
        echo $attr . " attribute is removed";
    } catch (Mage_Core_Exception $e) {

In a bootstrapped Magento environment, you can just do

$setup = Mage::getResourceModel('catalog/setup','catalog_setup');

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.