Shamim Ahmed Shamim Ahmed - 1 month ago 6
PHP Question

How to remove all Custom option of all Products in Magento

I need to remove all custom option from all magento products. I have about 4k products. and all has custom option. now we don't need custom option. so we need to need to remove all. Is the any simple solution as if I can remove all custom option easily

thanks

Answer

Preferably don't directly execute a database query, but use magento models:

<?php

require_once 'app/Mage.php';

Mage::init();

Mage::getModel('catalog/product_option')->getCollection()->walk('delete');

This -will- use multiple queries to delete your product options, but it should not be a big issue for 4000 products.

Comments