Menu Close
    Hire Us Request Quote Reading List Switch to Dark Mode

    Delete Custom Options of a Product in Magento 1

    Delete Custom Options of a Product in Magento 1

    Please use the following code to delete custom options of a product in Magento 1

    $productId = 1;
    $product = Mage::getModel('catalog/product);
    if($product->getOptions() != ''){
        foreach ($product->getOptions() as $option)
        {
            $option->delete();
        }
        $product->setHasOptions(0)->save();
    }
    

    $option->delete() will delete the custom options.

    Don’t forget to set setHasOptions to 0 before saving the product.

    Happy coding 🙂

    . . .

    Comment

    Add Your Comment

    Be the first to comment.

    Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close