We use cookies to improve our services and provide a better experience. By continuing to use this site, you agree with our Cookies Policy.


More than 400 step-by-step articles to guide you through online project development.
HomeTutorialsCMS TutorialsMagentoMagento Administration

How to Completely Delete Orders in Magento

Cloud Servers 727 x 90

In case you would like to delete unwanted orders from Magento admin backend, you have several options. Here we will a explain few of them.

Follow These Steps to Completely Delete Orders in Magento

In the oldest versions of Magento, it was not possible to delete the order completely. It was only possible to set order status to “cancelled”. Therefore, as a workaround it was possible to delete the order by executing MySQL query below:

 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;

As shown in the queries, first you are going to select order ID from the sales table and delete it by using the second query. This method can be used by executing MySQL query in phpMyAdmin interface. Simply open Magento database and click on “SQL” tab. Then put required SQL query and execute it.

For the newer versions of Magento, there are more comfortable ways to delete the orders. One of them by using PHP script which will find defined order and delete it from the orders list. The script can be found below.

$incrementId = 100000001;
$order = Mage::getModel('sales/order')->loadByIncrementId($incrementId);
$invoices = $order->getInvoiceCollection();
foreach ($invoices as $invoice){
$creditnotes = $order->getCreditmemosCollection();
foreach ($creditnotes as $creditnote){
$shipments = $order->getShipmentsCollection();
foreach ($shipments as $shipment){

There you will need to define increment ID which will be used to search for the orders. Usually, this ID contains only numbers like “100000037”. Then by using Magento functions it will go through all the orders and get required order which increment ID will match the defined one. This script can be implemented and used in Magento admin backend as a quick tool for deleting orders completely.

In case you are looking for a completely built in feature for deleting the orders, there is even an extension which will let you to delete the orders. Extension can be installed by visiting Magento Connect website and clicking “Install Now”. Please note, to get this extension installed, first you will need to be logged in to Magento Connect website. This means registration is required. After installing this extension, simply open orders list in Magento admin backend and select the order which needs to be deleted. Then select “Delete order” from the “Actions” list and click “Submit” button. Order will be deleted successfully.

Rate this Tutorial:
3 Comments Leave a Comment
  1. Jack Harson

    Thank for great infor!
    For amateur user who not familiar with coding process, I suggest a great extension that work well on both Magento 1 and 2. Managing orders in backend becomes easier than ever with this helpful tool!

    For Magento 1: http://bsscommerce.com/magento-delete-order-extension.html
    For Magento 2: http://bsscommerce.com/delete-order-for-magento-2.html

  2. Mathis

    I’ve found also an easier way to delete test orders, without using PHP scripts. The steps are described in this article: https://www.mag-manager.com/useful-articles/magento-orders-management/how-to-delete-magento-test-orders/

  3. James Thompson

    Thank you for a great article!
    To make an easier solution, we can also install an extension to delete orders quickly. There are a lot of modules to solve this issue.
    For example:


    I think it can simplify our process !

Leave a Comment

Cloud Servers 1 230×230

Other (215)

Popular Keywords

Web Banner 2 230×230