How to remove an Order in the PrestaShop 1.5 back office

Knowing how to cancel an order in PrestaShop 1.5 is extremely important. After adding or editing an order on a customer account, there may be an occasion to completely cancel it. This action does not actually delete the order, but places the order in canceled status. Orders are never completely deleted from your store. Follow along the steps below to learn how to cancel an order within the PrestaShop 1.5 back office.

NOTE: Orders can NOT be fully deleted from the database from within PrestaShop. This is by PrestaShop’s design and intended for more accurate record-keeping.

Canceling an order in PrestaShop 1.5 back office

  1. Log into your PrestaShop 1.5 admin dashboard.
  2. Using the top menu bar, hover over the Orders tab and click on the Order option.
    _order-messages
  3. You will now be at the Orders list page which shows all orders and other details such as their current status. Locate the order you want to edit and click on the View button on the far right side of the row. It is the one that looks like a paper with a magnifying glass.
    edit
  4. Now you are on the editing screen for your selected order. On the left hand side of the screen is a dropdown, which is for adding a new status to the order. This is to add a different status. Click on the dropdown and you will see a Cancel option. Highlight that and click on the Add button just to the right. This adds a row to the status list just underneath the dropdown.
    cancel-order
  5. cancel-status

  6. Click on the Back To List button found in the upper right corner to return to the orders list for you to review. The canceled order should now have a red Canceled status. This confirms your cancellation of the order in the PrestaShop 1.5 back office.
    cancel-after

13 thoughts on “How to remove an Order in the PrestaShop 1.5 back office

  1. To everyone who is interested in the “issue” i solved this way:

    I created a new order status named “Hidden” (id = 14)

    I placed 

    /override/controllers/admin/AdminPaymentController.php

    The controller override:

    class AdminOrdersController extends AdminOrdersControllerCore

     

    in the public function __construct()  

    before

    $this->_orderBy = 'id_order';

    I placed

        if(intval($_REQUEST['orderFilter_os!id_order_state']) == '14'){
              $this->_where = ' AND a.`current_state` = 14 ';
        } else {
            $this->_where = ' AND a.`current_state` != 14 ';
        }

    So the default behaviour is to show ALL ORDERS BUT HIDDEN,
    and if you want to see hidden orders you can filter the list by the "Hidden" status.
    1. Hello Nicola,

      We may be able to come up with a proper deletion method that you can run through phpMyAdmin. If you have no ‘real’ orders at all and simply want to remove all the test data, you can run the following code:

      TRUNCATE `ps_orders`;TRUNCATE `ps_order_customization_return`;TRUNCATE `ps_order_detail`;TRUNCATE `ps_order_discount`;TRUNCATE `ps_order_history`;TRUNCATE `ps_order_message`;TRUNCATE `ps_order_message_lang`;TRUNCATE `ps_order_return`;TRUNCATE `ps_order_return_detail`;TRUNCATE `ps_order_return_state`;TRUNCATE `ps_order_return_state_lang`;TRUNCATE `ps_order_slip`;TRUNCATE `ps_order_slip_detail`;TRUNCATE `ps_message`;TRUNCATE `ps_cart`;TRUNCATE `ps_cart_product`;

      Bear in mind this will remove ALL orders from the database and should ONLY be used to remove the test data after a fresh installation. As always be certain to create a backup copy of the database prior to running the script.

      As for the exact file to modify the primary order list in the back office, I have had no luck in identifying it as of yet. It is possible we may look into locating that file and activating the delete function. No instructions will be published on that without thorough testing to ensure it has no unexpected side effects.

      Kindest Regards,
      Scott M

  2. Maybe some of you magicians can help me to circumvent this problem of deleting test orders.

    Instead of deleting I’d like to HIDE the “canceled” orders as a default behaviour in order list page, maybe adding a “show canceled orders” button.

    I am getting crazy searching the template file where the order list is displayed.

    I could find the “order detail” page but not the “order list” page

    Order detail ovverride:  override/controllers/admin/templates/orders/helpers/view/view.tpl

    (if it’s not there, copy from /yourbackoffice/themes/default/template/helpers/view/view.tpl)

    1. Hello Nicola,

      The method for deleting records is not recommended for that reason, it does not fully go through the database and remove the rows from all the dependent tables. We do not have a formal response to this type of question as we will need to take the time to create and test it thoroughly. I will, however, place it on a project list so that we can avoid any other issues.

      Kindest Regards,
      Scott M

  3. BE CAREFUL

    Hello,

    I found that using the method stated above,  the order is actually dropped from the db,

    yet all the linked table records remains in the database.

    More strange is that whenever you place a new order, the new order id is the same as the first deleted order. So it happens that you have the new order, with (let’s say) one product “legally” added bu the customer, plus the ones formerly bought in the deleted order. So it’s a mess.

    Maybe the method above, trigger the order deletion, but also an Auto_increment -1 event in the db.

    something like

    ALTERTABLE users AUTO_INCREMENT={deleted_order_id}-1;
    1. Hello mhauthepooh,

      It was working in my 1.5.6.2 version, so you may want to do a test version of that to be sure it will work for you. A lot of things did change at the end of 1.5. so maybe this was fixed there.

      Kindest Regards,
      Scott M

  4. Hi Scott,

    Thank you for your quick reply. We tried cancelling the order by changing the status or by removing the items ordered from the products. Unfortunately, the stock count were not returned. I’m not sure if I miss anything, skipped a step or what. Any idea? Thank you 🙂

    1. Hello Mhauthepooh,

      Simply setting the order status to cancelled will cause the inventory count to be returned. That is the default behavior. If it is not working, there must be something else wrong with the program. You sound as if you have done everything correctly in returning the order.

      Kindest Regards,
      Scott M

  5. Hi Jacob,

     

    What will happen to the stocks quantity of the ordered products/items when you use the deleteOrder function? Will they, return the quantity ordered in the stocks?

     

    Thank you very much.

    1. Hello Mhauthepooh,

      If you cancel an order, the quantity on hand will add the number back into it. For example, if I had 10 ipods and an order was placed, the site will show 9 ipods available. Upon cancelling the order, the available ipods returns to 10.

      Kindest Regards,
      Scott M

  6. but if I have just testing the prestashop order mamagement and I have to compleately delete the order of “Jhon Doe” not just cancel it how can I do that?

    1. Hello Alexandru,

      As mentioned in the note after the first paragraph of this article, orders can not be deleted from the database from within PrestaShop. This is by design to allow for better record keeping.

      It looks like you can bypass this, but I would highly recommend that you backup your database in cPanel first before attempting to delete any orders.

      Login to your admin dashboard, navigate to Orders > Orders, then click on the magnifying glass icon on the far right to view the order you wish to delete.

      You should notice that on the order page the URL ends in something like this:

      index.php?controller=AdminOrders&id_order=1&vieworder&token=...

      Simply replace vieworder, with deleteorder, then hit enter in your web-browser’s address bar.

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

      Please let us know if you had any further questions at all.

      – Jacob

Was this article helpful? Join the conversation!

Questions about our MailChannels Deployment? We have answers and are here to help!Learn More
+