Black Friday & Cyber Monday SUPER SALE ALL WEEK:
Grab 40% OFF on plugins
Days
Hours
Minutes
Seconds

How WooCommerce order numbers are generated

You may have often wondered why, sometimes, WooCommerce order numbers don’t appear to be sequential. Order numbers being in order is something most site owners would expect to see, and for those seeing this for the first time, these out-of-sequence order numbers can be slightly misleading, causing one to think that some orders are missing or haven’t been updated in the list. In this post, we will explore why these numbers are not in order by understanding how exactly WooCommerce order numbers are generated. We will also see how we can assign sequential or custom order numbers.

how WooCommerce order numbers are generated - Default WooCommerce Order Numbers Screenshot
WooCommerce Order Numbers

WooCommerce is a WordPress plugin, and WordPress stores everything as a record in the wp_posts table in the database – whether it is a blog post, a page, a product, an image or an order. The default post types as well as custom post types are all stored in this wp_posts table. Thus, each time an order is created, a new record for it gets added in wp_posts table. All records in this table have a unique ID, and the order number is the same as this unique ID.

how WooCommerce order numbers are generated - The wp_posts table
The wp_posts table

Why do sometimes order numbers appear to be in sequence?

If, in between orders, there have been no new product additions, image/attachment uploads or no new page additions, then the order numbers may appear in sequence, as illustrated in the screenshot where order numbers 112, 113 and 114 are in sequence:

how WooCommerce order numbers are generated - Orders in Sequence

But, if a product is added to your store in between orders, this will also be considered as a post and a record for it will be created and assigned the next unique ID in sequence. If the product has an image (which it will, in most cases), then this image will also have its own record and ID. The same applies to new pages. This can cause the order numbers to be non-sequential.

shop_order Post Type

The post_type column in the wp_posts table denotes the type of post the record refers to. As you can see in the following screenshot, this takes different values such as shop_order, page, product, post, attachment and so on, depending on whether it’s an order, a page, a product, a post, an attachment (image) etc. Of these, ‘page’, ‘post’ and ‘attachment’ are default post types, while ‘shop_order’ and ‘product’ are custom post types. Click here to know more about WordPress post types.

how WooCommerce order numbers are generated - The post_type column in the wp_posts table
The post_type column

The process of adding new features thus becomes simple through the use of custom post types.

How to assign custom or sequential order numbers

Sometimes, as a store owner, you may want your order numbers to appear in a sequence. Sequential order numbers are useful in many instances, a simple example being when you want to confirm that no order has gone missing. Sequential order numbers are of paramount importance when it comes to accounting. In many countries, having sequential invoice numbers is mandatory. Having order numbers that are in sequence can thus be a necessity in such cases. There are many ways to achieve this requirement of order numbers appearing sequentially, and we offer a plugin for the same. This plugin is available in both free and paid versions, with different features in each:

Custom Order Numbers For WooCommerce- Free

how WooCommerce order numbers are generated - Custom Order Numbers for WooCommerce Plugin Screenshot
how WooCommerce order numbers are generated - Custom Order Numbers for WooCommerce Plugin Screenshot

With this plugin, you can assign custom order numbers. This includes sequential order numbers, random auto-generated order numbers (using a hash algorithm) or just the default order IDs. The sequence of these numbers can be reset either on a weekly basis, or on a monthly or yearly basis. With this plugin, you can also add a prefix to the order numbers, renumerate or recount existing orders, enable order tracking and admin order search by customer number. All this can be done through an interface accessible through the dashboard under WooCommerce->Settings itself.

Custom Order Numbers For WooCommerce- Premium

The premium version of this plugin offers the features offered by the free version and much more. With this plugin, you can even add a custom template for the order number consisting of a prefix, suffix, date, number etc. You can also add a suffix to each order, consisting of tags or dates.

Browse more in: WooCommerce How Tos, WooCommerce Tutorials

Share It:

Subscribe
Notify of
13 Comments
Newest
Oldest
Inline Feedbacks
View all comments
23 days ago

If I have an order number eg – #2301 and then a week later the next order number is #2310 does that mean 9 people did not check out – abandoned cart.

Editor
23 days ago
Reply to  Vicki

Hi Vicki,

The non-sequential order numbers that you have mentioned from #2301 to #2310 do not necessarily mean that 9 people abandoned their carts.
As explained in the post, other types of content (like new products or images) were added to the database they would also take up IDs in the sequence and thus the orders become non-sequential. If you’d like your order numbers to be sequential, try our plugin Custom Order Numbers for WooCommerce which doesn’t consider other content types like products or images added to your site. 

2 years ago

I’m creating a raffle site and I need a way to generate ‘ticket numbers’ not just order numbers.

Rahul
3 years ago

Hello, I am using the plugin “Custom Order Numbers For WooCommerce- Free” and it works for me. But I wanted to ask how I can locate the new custom order numbers in the database. I can find the old order numbers in the wp_posts table, but I can not locate the new custom sequential order numbers. Can any of you help me?

3 years ago

Nice post, got asked this today after about 10 years of using WC, I had an idea but this post is succinct, cheers!

Zunix
3 years ago

Can i make somehow consequence progressive numbers only by processing status?

13
0
Would love your thoughts, please comment.x
()
x