The invoice number is one of the most important component of an invoice. Every invoice should possess a unique invoice number, assigned sequentially. But what if you have chosen a number format which gets confusing as it gets bigger?
What do you do then? To break this complexity, one has to reset/delete the existing number system of the invoice. Let us see how we can delete the existing invoice numbers through code when using the WebToffee plugin, PDF Invoices and Packing Slips Plugin for WooCommerce.
Deleting invoice number via code
To remove all the invoice numbers generated:
- Add the following code to the end of the active theme’s functions.php file.
delete_post_meta_by_key( 'wf_invoice_number' );
- Remove the delete_post_meta_by_key( ‘wf_invoice_number’ ); code placed in the active theme’s functions.php to proceed further.(This step is mandatory).
- Ensure that the invoice number is blank on the WooCommerce order page.
Therefore, inserting the above code in functions.php will delete all the existing invoice numbers.
An alternative method: The plugin stores the invoice number under the meta key wf_invoice_number and contained in the table wp_postmeta. If you have access to the SQL DB of your website you can also delete it with an SQL query.
To reset and generate a different invoice number for the orders, refer: How to reset invoice number in WooCommerce.