WooCommerce is engineered with a simple but effective philosophy: include all the functionality required to create a basic eCommerce shop in a free and extendable plugin, and delegate all other features to free and premium extensions. The full implications and benefits of such a strategy will be discussed in a future article; while the remainder of this one will delve into its consequences for order numbers and how to customize them to fit your needs with the help of two different plugins.
Non-sequential WooCommerce order numbers explained
Some new WooCommerce shop administrators are surprised to find that their order numbers are non-sequential by default, for instance the first five orders placed in a new shop may be assigned numbers 5, 6, 13, 14, 27. Depending on your particular wants or business/regulatory/accounting requirements this behavior could range from being a non-issue, to desirable (competitors/customers less insight into what your shop order volume is like), to mildly inconvenient, to outright unacceptable.
The technical reason WooCommerce order numbers appear in this seemingly random sequence is simply because a WooCommerce Order record is represented within the database by a WordPress Post and the post id is used as the order id. If you have an active site with new posts/pages being created, or other plugins also creating post records for their own purposes, you’ll wind up with order numbers with these apparent gaps. Thankfully you have a few options, both free and paid, to deal with this.
Attaining (free!) sequential order numbers
If all you want or need is to have your order numbers without the aforementioned gaps you can achieve this by simply installing the free WooCommerce Sequential Order Numbers plugin. This plugin will begin assigning sequential order numbers as soon as its installed and activated; existing order numbers, even if they contain gaps, will not be altered, both for your existing customers’ and your accountants’ sanity.
Taking your order numbers to the next level
If you want complete control over your order numbers, combined with the peace of mind that an officially-supported premium WooCommerce plugin provides, you can use Sequential Order Numbers Pro. This plugin is fully compatible with the free version and will upgrade existing order numbers when installed. As you might expect the premium version guarantees the same sequential order numbers offered by the free plugin but with a number of significant benefits which, at the time of writing, include:
Order numbers can be started from any number. By default in a shop with existing orders the sequential order numbers will pick up from the highest current order number. If desired, order numbers can be started from a number greater than the highest order number. For new shops with no existing orders, the first order number can be whatever you want, even zero.
Custom order number length. The premium plugin allows you to set an order number length, which causes zeroes to be added to the front of your custom order numbers to ensure they are a certain length. For instance, with a length of 5 configured, order number 241 will be presented as 00241.
Dynamic order number prefix and suffix. You can add a custom order number prefix or suffix to your order numbers, consisting of letters, numbers, dashes, etc, and even containing the current year, month, day, hour, second or minute when the order was placed. With this feature plus the previous two, order numbers such as SV-1001-20130731, SV-1002-20130731, SV-1003-20130801 are a breeze to set up.
Free orders can be excluded from the main sequence. Useful in jurisdictions or countries where order or invoice numbers must be sequential for accounting purposes, this option allows you to exclude free orders from the normal order number sequence. Additionally, a free order prefix can be configured, so that an “order” for a sample product that doesn’t represent a financial transaction could be something like FREE-10, leaving your paid order numbers perfectly sequential.
Many of the above features were added to the Sequential Order Numbers Pro plugin over time and as requested by customers with various order number requirements, and more features and options will doubtless be added in the future as the number of WooCommerce-powered shops expands and with it the need for more customized order numbers.