I need to delete about 7500 orders and keep the orders from 26.08.2016 and onward. I would like to do it through db query. Is it possible or I have to stick with admin panel?
Magento 1.9 – Delete All Orders Older Than Specific Date by DB Query
deletemagento-1.9orders
Best Answer
you can try this, but backup first in case I'm wrong.
I don't recommend using direct queries because you might end up with zombie data.
You can create a script:
First tell the script that you are on the admin area:
Then get the orders:
Now for each order you have to delete the invoices, invoice items, shipments, shipment items, creditnotes, creditnote items, order items, payment references, quote, quote items and in the end the order itself.