Home > Docs > WooCommerce PDF Invoices, Packing Slips and Credit Notes Plugin > Deleting Existing WooCommerce Invoice Numbers

Deleting Existing WooCommerce Invoice Numbers

Last updated on January 4, 2024

For big businesses dealing with lots of orders, deleting old invoice numbers is really helpful. It fixes mistakes, makes the system faster, and saves time when searching for invoices. The WebToffee’s WooCommerce PDF Invoices, Packing Slips, Delivery Notes, and Shipping Labels plugin allows store owners to delete existing invoice numbers. Store owners can do this in two ways:

  1. Using a custom tool. Steps to follow while using a custom tool for deletion are as follows:
    1. Navigate to the Invoice settings page.
    2. Clear all the order statuses selected under Automate invoice creation.
    3. Navigate to WooCommerce > Status > Tools.
    4. Perform the deletion using the Delete all generated invoice numbers tool.
  2. Using a custom code snippet. Steps to follow while using a custom code snippet for deletion are as follows:
    1. Add the custom code snippet to the WordPress site in use.
    2. Refresh the WooCommerce Orders listing page.
    3. Once done with the deletion, remove the custom code snippet from the WordPress site.

Deleting invoice numbers using a custom tool

To delete all the existing invoice numbers:

  1. Navigate to Invoice/Packing > Invoice > General.
  2. Under the General section, head to Automate invoice creation.
Automate invoice creation
Automate invoice creation
  1. Clear all the order statuses selected under the Automate invoice creation option.
Clearing order statuses
Clearing order statuses
  1. Click on Update Settings.
  2. Now, head to WooCommerce > Status > Tools
  3. Under the Tools tab, navigate to the Delete all generated invoice numbers tool.
Delete all generated invoice numbers
Delete all generated invoice numbers
  1. Click on the Delete button present against the tool. On clicking the Delete button a confirmation window will pop up.
Delete button
Delete button
  1. Click on the OK button and run the tool.
Confirmation box
Confirmation box

Deleting invoice numbers using a custom code snippet

To delete all the existing invoice numbers using a custom code snippet, follow these steps:

  1. Add the custom code snippet below to the WordPress site which is currently in use. Add it to the active child theme’s functions.php file or use a third-party plugin for the addition. To know more about how to add a custom code snippet using a third-party plugin, refer to this article.
delete_post_meta_by_key( 'wf_invoice_number' );
  1. On adding the code, refresh the WooCommerce Orders listing page and make sure that the existing invoice numbers are deleted.
  2. On deletion of the invoice numbers, remove the custom code snippet from the WordPress site.

Alternative Method

The plugin stores the invoice numbers under the meta key wf_invoice_number and contains them in the tables wp_postmeta and wp_wc_orders_meta. If you have access to the SQL DB of your website you can delete it with an SQL query.

Upon deletion of the existing invoice numbers, the WooCommerce Orders listing page will look like this:

WooCommerce Orders listing page after deletion of existing invoice numbers
  • To know more about how to create invoice numbers for upcoming orders, refer to this article.