I tried to delete orders in the backend but i can only set the status to “cancelled” and the order is still there.
How can I delete the order complete from the backend so that it isn’t shown anymore?
I would assume there will have to be a SQL query solution (as opposed to anything in admin), but I haven’t familiarized myself with the database structure enough to feel comfortable poking around and dropping records on my own..
If your database was correctly setup with InnoDB, to delete an order using public order ID:
select @order_id:=entity_id from sales_order_entity where increment_id='100000001'; delete from sales_order_entity where entity_id=@order_id or parent_id=@order_id;
There is not option in the admin to delete orders at the moment.
It is possible that it will be in some future release or contributed by the community.
select @order_id:=entity_id from sales_order_entity where increment_id=’100000001’;
delete from sales_order_entity where entity_id=@order_id or parent_id=@order_id;
How do i make the above code work for me? I want to delete previous orders from my Orders Category. Where do i type this code? Where do i upload it? I need the instrctions please! :(
You’ll need to apply this SQL Query/command directly to your magento database. I used phpMyAdmin for this, which is provided with most hosting plans.
Disclaimer: Please be sure you know what you’re doing before running raw SQL commands, and back up your database first, just in case something goes wrong in the process.
Is there already a good way available to remove test orders? We want to go live with the shop but we cannot do that because of all the test orders. Using the SQL code above was not succesfull.
The above query by Moshe works fine for me but I found it doesn’t remove entires from the Sales>Orders page. To do this all I did was delete each entry in the sales_order table and it worked - no more test orders anywhere!
It’s always a good idea to run a quick simple phpMyAdmin export to backup your entire database before messing around in there… In phpMyAdmin make sure you are in the root, if you are not click on your db name at the top on the left hand side. You should see all the db tables appear in the window. Now click on the Export tab. Here just make sure all your tables are selected, leave everything else at default (unless you know what you’re doing), and check “Save as file” at the bottom. You can also select whether or not you want any compression and the name template. Then just click Go in the right bottom corner and a save dialog should appear letting you save the db backup to your computer somewhere. If anything ever goes wrong doing these db edits you’ve got a full backup! Restoring is even easier! Just go to the Import tab, select your file you just saved, leave everything else at default and click Go! Poof!!!! Restored to all its former glory. Yay!
Yeah, that query is not cleaning up all the records of the orders that I am trying to delete.
Anyone have an updated query to run to completely delete orders?
Thanks.
In phpmyadmin I just go into the “sales_order” table and just delete the order from there and it works for me.
After looking at it more this does not delete the order completely from the system.
Where in the database does it save the info for the bestsellers? After creating a test order I would like to take the number ordered down one so it does not inflate the best seller list.