The invoice number is one of the most important components of an invoice. Every invoice should possess a unique invoice number assigned sequentially for easy auditing.
However, if you have a large number of orders that you may not want anymore, you can delete the invoice numbers of those orders and reuse the same invoice number on new ones.
For example, say you have a thousand order invoices with invoice numbers from 1 to 1000 and you have already completed its auditing. You can delete the invoice numbers of these invoices and reset the invoice counter to 1. This way, the next invoice generated will have an invoice number of 1 instead of 1001.
Let us see how we can delete the existing invoice numbers using the WebToffee plugin – PDF Invoices and Packing Slips Plugin for WooCommerce.
Delete or Reset WooCommerce Invoice Numbers
The existing invoice numbers generated with the plugin ‘WooCommerce PDF Invoices, Packing Slips, Delivery Notes & Shipping Labels’ can be deleted using a custom tool or via a code snippet.
Delete invoice number using a custom tool
Note
You will need the WooCommerce PDF Invoices, Packing Slips, Delivery Notes & Shipping Labels plugin
- Basic version 3.0.3 or above
- Pro version 4.4.2 or above
to avail the custom tool.
To delete all the existing invoice numbers,
1. Navigate to Invoice/Packing > Invoice > General.
2. Remove all the order statuses selected under the Create invoice automatically.
3. Go to WooCommerce > Status > Tools from your WordPress admin dashboard.
4. Scroll down to Delete all generated invoice numbers and click on Delete.
Deleting invoice number via code
Note
Use this method if your WooCommerce PDF Invoices plugin version is below 4.4.2 (Pro version) or 3.0.3 (Basic version).
To remove all the invoice numbers generated,
- Make sure that the Create invoice automatically field under Invoice/Packing > Invoice > General is empty.
- Add the following code to the end of the active theme’s functions.php file.
delete_post_meta_by_key( 'wf_invoice_number' );
- Now, remove the code delete_post_meta_by_key( ‘wf_invoice_number’ ); placed in the active theme’s functions.php to proceed (This step is mandatory).
Note
Once the code is added, refresh the WooCommerce order page (or any page on the site) and ensure that all the generated invoice numbers are removed.
Alternative method
The plugin stores the invoice number under the meta key wf_invoice_number and is contained in the table wp_postmeta. If you have access to the SQL DB of your website you can delete it with an SQL query.
Note
Once you have deleted the invoice numbers go to WooCommerce > Orders and make sure that the entries in the invoice column are removed.To reset and generate a different invoice number for the orders, refer to the article on creating/resting WooCommerce invoice numbers.