Detele PrestaShop Orders - Store Manager for PrestaShop
Rating 4.00 stars - 4 votes

How to Delete Orders In PrestaShop

You’ve probably found this article when looking for a solution to delete PrestaShop orders. Indeed, many users face this task when they want to remove test orders and find out that there is no such option in the PrestaShop back office.

“Why Cannot I Delete PrestaShop Orders?”

Before we get down to methods of deleting orders, let’s figure out why this option is not available by default.

In PrestaShop documentation, they explain that European law requires to store payment, ordering, and invoice information. (Source) That’s why they can’t offer the “Delete” option for orders by default.

Orders and invoices contain payment information from the clients and removing it is basically how the fraud starts. The platform cares about the security of customers and limits store owners of the ability to do illegal things, especially by mistake. They advise canceling the order instead of deleting it and keep your orders section like an accounting program with all the details stored.

To change the order status to “Canceled”, go to your store back office, navigate to “Orders”, select the order(s), expand the “Status” drow-down and click “Canceled”

.
PrestaShop Backoffice Changing Order Status to Cancelled


How to Delete Test Orders in PrestaShop

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


Important! After deleting the data, you can’t roll it back. Secure your store by making a database backup before deleting important data.

So here are the solutions to removing orders from PrestaShop:

  • Installing PrestaShop Cleaner Module
  • Editing an order URL in a browser
  • Adding a Line of Code in the AdminOrdersController.php File
  • Creating an SQL Query
  • Using the “Delete Orders” option with Store Manager for PrestaShop.

PrestaShop Cleaner Module

PrestaShop recommends using its native PrestaShop Cleaner module to delete orders. The module allows you to clean your store and delete the whole catalog, orders, and customers. The module is available in the default installation since v.1.5.4. Note that PrestaShop Cleaner removes ALL order data, you can’t remove just certain orders.

Editing Order URL in a Browser

Here is another method offered on forums.

  • In the “Orders” section find the order you want to delete and press “View order”. The order page URL will look something like that in the browser:
  • http://YOUR_SITE/admin/index.php?controller=AdminOrders&id_order=1&vieworder&token=…

  • Replace vieworder, with deleteorder in the link in your web-browser’s address bar and press “Enter”.

  • After that in the orders notification bar, you will see the message Deletion successful, and the order won’t be in the list any longer.

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

Though this method may seem very simple we don’t recommend using it. When you delete an order this way it is removed only from the “ps_orders” table. But order information stays in many other tables and can later cause errors in the database.

Editing the AdminOrdersController.php File

This allows you to add a “Delete” button in your “Orders” section. Though there is a single line of code to be added people who are not familiar with PHP should be careful as removing some necessary lines can break your shop.

If you decide to use this way, here are the steps:

  • Open your PrestaShop root directory and go to controllers/admin/AdminOrdersController.php
  • Open the file with a Notepad or other editor that you use to open PHP files.
  • Beneath the line $this->deleted = false; add the line $this->addRowAction(‘delete’);
  • The final code should look like this:

    public function __construct()

    {

    $this->bootstrap = true;

    $this->table = ‘order’;

    $this->className = ‘Order’;

    $this->lang = false;

    $this->addRowAction(‘view’);

    $this->explicitSelect = true;

    $this->allow_export = true;

    $this->deleted = false;

    $this->addRowAction(‘delete’);

  • Save the file and refresh the “Orders” page in the PrestaShop back office. Now when you hover over “View order” the “Delete” option will appear.

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

Creating an SQL Query

If you have some special tech skills, you can create an SQL query or find any on 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.

Using the “Delete Orders” option with Store Manager for PrestaShop

The functionality that is not included by default can be usually achieved via external solutions. One of them is Store Manager for PrestaShop.

Store Manager for PrestaShop is an all-in-one application that enhances the default functionality of PrestShop and offers you multiple tools to speed up store management. Read more…

How to delete PrestaShop Orders with Store Manager:

  1. Download the free trial version of Store Manager and install it on your computer.
  2. Connect to your store database and get all store data displayed in the application.
  3. In the menu, navigate to “Orders”, use a filter to select the orders you want to remove, and press “Delete” on the toolbar:

Store Manager for PrestaShop Delete Orders Option


It is worth noting, that you may come across some other store cleaners that can remove test data from your store. 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 to remove.

Store Manager, on the contrary, enables you to select certain orders and remove them with a single mouse-click.

In case you have PrestaShop 1.7 – delete orders free by using Store Manager trial version. Explore other advantageous functionality like importing PrestaShop orders, cloning them, changing order statuse in bulk, and many others.

Remove test orders one by one and in bulk with Store Manager for PrestaShop – TRY FREE!

Related Articles:

 
Card image
Print PrestaShop Receipts via Till Printer
 

Check the way to print PrestaShop till receipts in few clicks. Read More…

Card image
How to Import Orders to PrestaShop
 

Find out what should orders import file include and how to configure it’s upload settings. Read More…

Card image
Export PrestaShop Orders Quickly and with Ease!
 

Use these instructions to easily export order data to CSV, XML and HTML via Export Wizard. Read More…

Card image
Why I Cannot Create Order in PrestaShop POS?
 

Get the list of solutions to a bulk of PrestaShop order management troubles. Read More…

COMMENTS
Be the first to comment.