Search the site:

Home Blog How WooCommerce order numbers are generated

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 apper 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: 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.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
  • 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

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of
from purchased

Subscribe for more offers