THE DIGITAL BLOG

How to Delete Test Orders and Reset Counters in Magento

What happens when you want to launch a new Magento site and you're stuck with dozens of undesirable test orders?

Posted on October 6, 2009 2 comments

More Articles...

You'd have thought there was a basic provision for this in Magento, but unfortunately this is not the case and, looking at this thread on the Magento forums, it's not something that Varien are looking at correcting at any point in the near future.

The problem is that in-development stores need testing; to do that properly, you need to push test orders fully through the system, from invoice to completion.

The first thing you need to bear in mind is that, whilst this is possible using a load of MySQL queries, that kind of thing on a working site is pretty scary and risky if you're not sure what you're doing. For this reason, I would recommend purchasing the Yireo extension Delete Any Order which will do the job for you. It will also scan the database for orphaned sales data and remove, something which would take significant time by hand.

The extension costs a mere EUR20 and is worth it just for the piece of mind. Whatever you choose, please ensure you backup your database first.

Deleting the Orders

Once you've purchased the extension, upload it to the root of your Magento site.

This will give you an additional option in System->Tools called "Delete Any Order". Select it to run the extension.

If you are preparing a store for launch and want to remove all orders and reset the sales reference numbers, select all orders and choose the "Delete" option from the drop-down menu (top-right).

Reset the Counters

You don't really want your new store starting orders, invoices, shipment and credit memos from some random number do you? Do the following to reset these counters to the default (1000001).

1. Use PHPMyAdmin to view your database.

2. Click the "SQL" tab.

3. Paste the following query into the code entry window:

TRUNCATE `eav_entity_store`;
ALTER TABLE `eav_entity_store` AUTO_INCREMENT=1;
SET FOREIGN_KEY_CHECKS=1;

4. If all goes well, the system will display a message stating that the query was a success.

The next order placed will now use the default number to start.

I recommend testing these steps out on a test site rather than your live environment, if that's possible – just so that you are comfortable with the steps before deploying on a live site.

There are 2 awesome comments...

  1. Maria - July 22, 2015 at 12:41 pm

    Thank you sharing your experience on how to tackle problem in database. For those who do not have any idea about running that queries, there is one more useful extension to remove orders. You can download free version of Store Manager for Magento

  2. Julie - April 25, 2016 at 4:19 am

    Thank you so much for a very detailed instruction to delete order in magento admin
    Although I’m not specified in IT, it’s easy to follow and make it successful

Leave a comment:

I consent to Toolbox Digital collecting and storing my data from this form, as detailed in the Privacy Notice.

Previous:

Next up: