Home » Magento22 January 2016

Magento: Delete Orders Programmatically

Here is a quick code to delete orders programmatically in Magento. In Magento, there isn’t the facility to delete orders from admin grid. You need to write custom code to delete orders in Magento.

Here is the full code to do so. This code can be saved in a new file in your Magento root folder and then you can run it in browser.

In this code, I have selected orders created within a certain date range. And then deleted those selected orders individually.

Hope this helps.
Thanks.

Magento

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • lysdexia

    What version of magento did you test this against?

    Is $id magically created somehow?