How to reset/delete existing invoice numbers

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' );
Delete code added at the end of functions.php file
  • 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.removed-invoice-details

Therefore, inserting the above code in functions.php will delete all the existing invoice numbers.

To reset and generate a different invoice number for the orders, refer: How to reset invoice number in WooCommerce.

  • Was this article helpful?
  • YesNo