We often receive questions about the sequential character of PDF invoice numbers from our WooCommerce PDF Invoices plugin:
This article explains exactly how invoice numbers work, and why.
The answer is simple: because many countries require invoice numbers to be sequential (gaps are not allowed). WooCommerce or WordPress don’t automatically do this for you.
By default, WooCommerce orders are numbered in the main WordPress post numbering system. This includes everything on WordPress: posts, pages, images, orders, coupons, products, etc. So if you create a new product between when two orders are placed, and upload an image for that product too, the order number is not sequential (if the first order was #100, the product would be #101, the image #102 and the next order #103). This is not ideal for invoices, most tax authorities require that invoice numbers are sequential without gaps.
There’s a plugin that fixes this behavior: WooCommerce Sequental Order Numbers. This will make sure that in the above example, the order sequence would not be broken. However, for invoice numbers, this is still not accurate enough. What about fake orders, or orders that are never finished because there was an issue with the payment and the customer places a new order? They get order numbers too, but shouldn’t get an invoice number. This is where a separate invoice numbering system comes in! Which leads us to the next question:
Invoice numbers are assigned at the moment a PDF invoice is created, either manually (by pressing the buttons or executing the bulk action), or automatically (by means of email attachment). This depends completely on the plugin settings. If you attach the invoice to the Admin New Order email, this means the invoice (and invoice number!) will be created immediately after the order is placed – for most setups, this is not recommended! The ‘safest’ way is to attach the PDF invoice only to the Customer Completed Order email and the Customer Invoice email. This will make sure an invoice number will not be created automatically before the order is completed. Additionally, if you want to prevent invoices for ever being created for specific order statuses, you can add these to the “disable for:” setting.
If you want to send the customer an invoice without affecting the invoice numbers, you can use the WooCommerce PDF Invoices & Packing Slips Professional extension: this will allow you to create Proforma Invoices, which have their own, separate (sequential) numbering system.
We can’t change invoice numbers from invoices that have already been issued (in most countries that would be considered a fraudulent action), but with the WooCommerce PDF Invoices & Packing Slips Professional extension you can create Credit Notes. These are negative invoices that can either have a number that is in the same sequence as the invoice numbers, or a completely separate (again, sequential) numbering system.
You can reset the invoice numbering in the plugin settings, under Template Next invoice number. Enter the number that you want to use for the first invoice that will be created here. Note that this will not change or remove any existing invoice numbers!
If you don’t need the invoice numbers to be sequential, and you want the invoice numbers to match the order numbers, you can do so by going to WooCommerce > PDF Invoices > Documents > Invoice and setting the Display invoice number option to Order number.
This will automatically format the order number with all the settings you have configured for the invoice number.
Internally, the invoice number is created like this: