The mystery of the missing WooCommerce order numbers
One of our WordPress clients was recently concerned that there were gaps in the ID numbers of the orders on her WooCommerce website.
At first, I assumed that the missing order numbers were due to some test orders that we had deleted as part of the web design process. However, it kept happening so we investigated and discovered a simple plugin to fix the problem.
Why are my WooCommerce order numbers not sequential?
The answer is fairly obvious if you know how WordPress works behind the scenes. However it wasn’t obvious to me – and millions of people use WooCommerce, so I’m sure I wasn’t alone. I’m writing this post for anyone who is wondering about missing order numbers on their WooCommerce website.
Gaps in WooCommerce order numbers are not caused by a bug or error with the website. In fact, order numbers are not supposed to be sequential.
The way it works is that EVERY item in the WordPress database is given a unique ID number, which is allocated sequentially. This includes orders, pages, posts, images etc. so the numbers are not just used for orders.
For example, someone may place an order which is assigned the ID 17004 and then you might add a new post which is given the ID 17005. The next person who places an order will be assigned the ID 17006, so 17005 will look like a missing order number. It’s not a missing order number – 17005 has simply been used for a post instead of an order.
This means that looking at the order numbers is not a good way to track your WooCommerce orders.
What’s the alternative?
The WooCommerce Sequential Order Numbers plugin fixes the problem. It allocates custom order numbers to your WooCommerce orders. These are sequential – with no gaps – as they’re not used for anything else. They work by creating a dedicated ‘order number’ field in the database which is separate from the WordPress ID.
This simply plugin is really handy if you want your WooCommerce orders to be sequential.