Reading list Switch to dark mode

    Delete Custom Options of a Product in Magento 1

    Updated 26 October 2018

    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 🙂

    Searching for an experienced
    Magento Company ?
    Find out More
    . . .

    Leave a Comment

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


    Be the first to comment.

    Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home