2015-02-18
Rating 5 stars - 1 votes

How to Delete Orders In PrestaShop

You probably found this article because of the need to remove orders in PrestaShop. Obviously after you have realized that here is no “X” button for deleting orders in back office, you started looking for the solution.

You have reached the right place, as here we have summarized all the possible methods of performing the tasks and explaining why PrestaShop itself does not include this functionality.


Why PrestaShop does not Allow to Delete Orders?

PrestaShop itself recommends that orders need to be stored. The main reason is that orders and invoices contain payment information from the clients and removing it is basically how the fraud starts. PrestaShop cares about the security of customers and limit store owners of the ability to do illegal things, especially by mistake. They advise to cancel the order instead and make your orders section like accounting program with all the details stored.

To perform this operation in your PrestaShop back office go to Orders -> press button to View order-> select ‘Cancelled’ status from the drop-down and press ‘Add’.



Do You Have Test Orders?

You might have not noticed about the lack of ability to remove sales info. So most likely when you were playing around with your store still being on the production stage, you have created too many test orders. Now your statistics reflects wrong information and will do that in the future in long-term sales reports.


So in case you are looking for the possibility to remove test orders (and only for that reason!) we have investigated and gathered possible tricks and methods to get the task done. They all have pro’s and con’s, thus, it is left for you to decide what is more suitable.

In any case, first thing that is recommended before you decide to do any action with orders removal is database back-up that is obligatory before mass operations.


Method 1

You might have ever noticed, that when viewing each order, order page the URL in the browser ends in something like this:


http://YOUR_SITE/admin/index.php?controller=AdminOrders&id_order=1&vieworder&token=…


What you need to do is to simply replace vieworder, with deleteorder in the link and then hit enter in your web-browser’s address bar.

Then you should be presented with the message Deletion successful and you shouldn’t see the order in your admin dashboard any longer.

You will have to repeat the procedure for each order you need to remove, opening them one-by-one.


Method 2

It allows you to add to your PrestaShop backend ‘Delete’ button in Orders section. However, it involves form you code editing. There is a single line to be added, but for people who do not ‘speak’ PHP it can be frightening as if you miss anything or remove some necessary lines, you can break your shop.


If you decide to use this way, you should:

  1. Go to your Prestashop root directory and find AdminOrders.php (/admin/tabs/AdminOrders.php)
  2. Open it with notepad or other editor that you use to open php files
  3. Inside the Construct find the line $this->colorOnBackground = true;
  4. Below that line add define this variable $this->delete = true;
  5. Save it! and try to refresh Orders page in PrestaShop admin panel, the “Delete” button now appear

This might not work for all PrestaShop versions (tested on 1.4.x). In other versions you might need to modify other files adding different lines of code.


One more thing, the users on forums often report that this method deletes the order only from `ps_orders` table but the order information stays in many other tables that can later on cause difficulties.


Method 3

If you have some special tech skills, you can create SQL query or find any in the web. Though, you need to consider your PrestaShop version and need to be sure what you are doing. Besides, the ones we have come across caused all the orders to be deleted, so this solution will be suitable for the owners of shops with no real sales from real clients.


Method 4

The thing that is not included by default is usually can be achieved using extensions. If you look for some, you may find store cleaners of test data and desktop solution called Store Manager for PrestaShop.


Store cleaners mostly delete all test orders. In case you have got new sales from your clients, you will not be able to select what purchases to keep and what were made for test.

Store Manager for PrestaShop, on contrary, enables you to select what orders you need to be removed and allows in bulk unlist selected purchasing records with a single mouse-click.


In the application go to Orders section ->Filter them -> Select purchases that need to be removed-> Press Delete.

That’s it!



Besides, the application is designed to be used on your PC, not web-based, so installation of it will be easy like any PC-program, basically, click a few times next and you are done.

Remove test orders in one click and explore more useful functionality with 30-day free trial of Store Manager for PrestaShop – TRY FREE!