Aan huis, Bij ons
Hulp Nodig?
0471 84 89 83
Prestashop – How to delete invoice and fix invoice counter

What can you do with a fraudulent order or some other test order that you wish to delete from you prestashop… By fiscal law, all invoices should counter up, by 1 digit at a time. So remove an invoice, without fixing the invoice number means that you will be missing 1 invoice. Prestashop does not offer any feature to delete 1 invoice. Since we recently suffered from a fraude order, that we managed to cancel at the very last moment, we want to share this with other shop keepers.

So this small tutorial will teach you how to delete invoice and fix invoice counter, just by deleting the invoice from your database.

1Back-up your database

Be for trying to attempt anything in your database, please back it up with the DB-Backup tool from prestashop backoffice. Takes 10 seconds and you are safe!!!! In case you fail, just import the database with your PhpMyAdmin importer.


2Find and delete the invoice in PhpMyAdmin

First we must know the invoice number from prestashop that we want to delete. Check out the Orders tab and find out which invoice you want to delete. Copy that number. Then go to your phpmyadmin page and click the main database from your prestashop. Then on the top click search like the image below.

Prestashop - How to delete invoice and fix invoice counter

If you have are in the search tab, paste the invoice number, select all the database tables and then click START. After that you should see the results and it will show you 2 tables with where the invoice is found. Click on both the links Explore which I have marked yellow. See example below:

Prestashop - How to delete invoice and fix invoice counter 2

In the new tab with the result result, which you have to open for both found records…. you have to double check if this is the invoice you want to remove. If so, tick the checkbox and then the delete link. Make sure you remove the invoice in the 2 tables like i mentioned before!!! So check it out in ps_orders and ps_order_invoice.

Prestashop - How to delete invoice and fix invoice counter 3

3Check the result

To see if the counter has been reset, go to Orders > Invoices and see the item Invoice number. It will show you what the next invoice will be. See example below:

Prestashop - How to delete invoice and fix invoice counter 4

4What if a newer invoice came in before deleting?

Let’s say that just before you wanted to delete this invoice, another order came in… Well the only thing do to is to change the invoice number(s) from the newest one. Since you deleted 1 invoice, you will have to reduce the newest invoices with 1. To do so, use the database search function again in phpmyadmin and locate the newest invoices that you want to correct. Just replace the invoice number with the correct one AND do it always for the 2 tables: ps_orders and ps_order_invoice.

Questions? Just use the comment form.

4 thoughts on “Prestashop – How to delete invoice and fix invoice counter

  1. Adam

    14 oktober 20165 jaar ago


    for delete invoices and set couter for invoces numbers, you can you this module:

  2. Horia

    29 mei 20184 jaar ago

    Actually, this procedure is still considered illegal. YOu should not temper with the invoices. If you have a cancelled order, you can also cancel the invoice. You just have to add a “CANCELED” watermark on top of the original invoice.

    1. Vanhims

      29 mei 20184 jaar ago

      Altering invoices is indeed illegal, this also includes removing invoices from the bookkeeping. But this article is not about altering invoices nor a procedure how to do such operations.
      I created this page to help people remove for example : test orders from the database. This can be useful if you want to test your checkout without using sandbox payments. There is a need for this, if you google it… So, I still hope people find this helpfull in case you will ever need it!

  3. claudio

    17 juni 20201 jaar ago

    Hi there, I know this is an old post…
    I would ask you, if I need only to cancel the invoice but not the order, that is now marked as “canceled”(so I can give it’s number to the following invoice, as you displayed) can’t I leave the ps_order record and erase only the p_orderinvoice record?
    Last question please: . shouldn’t I cancel other records in other tables (you tell TWO, I have really many) to avoid having the db misaligned?
    Thank you, best regards.

Comments are closed.

Heeft u ons nodig?

Wenst u graag een herstelling te plannen, offerte of project bespreken? Eenvoudig en snel online aanvragen. Afspraken zijn zo geregeld.