Check onze webshop voor software en hardware. custom IT webshop.

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.

 

 

One Comment

Adam
posted on 14 oktober 2016 Beantwoorden

Hello,

for delete invoices and set couter for invoces numbers, you can you this module:
http://addons.prestashop.com/en/19983-custom-invoice-reference-numberedit-and-remove-invoice.html

Leave a Comment

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *