Why WooCommerce order numbers have gaps
WooCommerce does not keep a separate order counter. An order is a record in the database, and its number is simply the ID of that record. On a classic installation every post, page, product, image and revision shares the same ID sequence, so between two orders a dozen other things may have been created. Stores on High-Performance Order Storage have their own orders table, but the IDs there are still database IDs, not a business sequence. The result is #1842 followed by #1877.
That causes real problems. Accountants in many countries expect invoice numbers to be consecutive, and some tax authorities require it. Customers wonder why their order number is five digits on day one. Competitors can estimate your volume by placing two orders a week apart. And nothing in the number tells you when the order was placed or which channel it came from.
A custom order number replaces the database ID with a format you design, assigned when the order is created and shown everywhere WooCommerce shows the order number. The underlying ID still exists for the software; the customer and the accountant only ever see yours.
Designing a format
A good format is made of four parts, used in whatever order suits you: a prefix, a sequential counter, an optional suffix and an optional date. With Personalised Order Numbers, ProCom’s extension on the WooCommerce Marketplace, you pick one of 13 layouts that combine these, from a bare [number] to [prefix][date][number][suffix], and set:
- Prefix and suffix: any text, for example
INV-or/WEB. - Order Number Length: fixed-length zero padding, excluding the prefix, so 123 becomes
000123at length 6. - Start number and counter step: start at 10000, count in steps of 5, or anything in between.
- Date format: bracketed tokens for day, month, year, hour, minute and second,
[d] [j] [m] [n] [y] [Y] [G] [H] [i] [s], so[y][m]gives 2611 and[Y]-[m]-[d]gives 2026-11-20, in your store’s timezone. - Reset interval: never, daily, monthly or yearly.
The reset is what makes invoice-style numbering work. Combine a monthly reset with a [y][m] date and you get INV-2611-0001, INV-2611-0002 and so on, starting again at 0001 on the first of December as INV-2612-0001. The date part keeps the numbers unique across months while the counter stays short.
Setting it up step by step
Enable and choose a layout
Go to WooCommerce → Settings → Personalised Order Numbers, enable the plugin and pick a layout. Fill in prefix, suffix, length, start number, step and date format as needed.
Set the reset interval
Choose never, daily, monthly or yearly. If you reset, include a date token in the layout so numbers stay unique across periods.
Watch the live preview, then save
The settings screen shows the next paid and free order number and updates it as you type, so you see
INV-2611-0043before you save rather than after the first customer does. Save, and the next order gets the new format.Check where it shows
The personalised number appears on the order screen, in a sortable Personalised # column on the Orders list, as a labelled line in customer emails, in My Account, in the order-tracking form and in invoices from plugins that read the WooCommerce order number. Admin order search finds it too.
Orders placed before you enabled the plugin keep their numbers. If older or imported orders already use a number in your new range, the counter catches up past them rather than falling back to a random reference, so there are never two orders with the same personalised number.
Five formats stores actually use
| Use | Layout | Settings | Example |
|---|---|---|---|
| Invoice-style, monthly | [prefix][date][number] | Prefix INV-, date [y][m], length 4, reset monthly | INV-2611-0042 |
| Plain sequential from 10000 | [prefix][number] | Prefix #, start 10000, step 1 | #10042 |
| Year-stamped, yearly reset | [prefix][number][suffix][date] | Prefix WEB, length 6, suffix /, date [Y], reset yearly | WEB000042/2026 |
| Hide volume with steps | [number] | Start 500, step 5 | 705 |
| Free orders apart | Separate free sequence | Free prefix FREE-, length 3 | FREE-017 |
Duplicates, caches and other things that go wrong
The hard part of sequential numbering is not the format, it is concurrency. During a sale two customers can complete checkout in the same second. A naive implementation reads the last number, adds one and saves, and both orders get the same number. The plugin advances the counter under an atomic database lock and runs a final uniqueness check before the number is saved, so simultaneous checkouts each get their own number.
The second trap is storage. A counter kept in an object cache or a transient disappears when the cache is flushed or the site moves hosts, and the sequence silently restarts. Here the counters live permanently in the WordPress options table, so clearing caches does nothing to them.
A few more points worth knowing:
- Manual control. Edit Last Generated Order Number, and its free-order twin, at any time to reset the sequence or skip ahead. The next order gets that value plus the step.
- Every way an order is created. Numbers are assigned for the classic checkout, the block checkout and Store API, the REST API, WooCommerce Subscriptions renewals and WooCommerce Deposits, and passed to payment gateways that reference the order number.
- HPOS. Full support for High-Performance Order Storage and legacy storage, including the Orders list column.
- One global format. There is one format for paid orders and one for free orders. Per-status or per-site numbering on a multisite network needs a custom build.
- Logs. Errors are written to WooCommerce → Status → Logs, which is the first place to look if a number ever looks wrong.
Once configured, order numbers stop being a database artefact and become part of how the business presents itself: short, consecutive, dated and the same on the order screen, the email and the invoice.
// Next step
Do this with Personalised Order Numbers
Custom order-number formats with prefixes, suffixes, dates and counters. Sold on the official WooCommerce Marketplace with a 30-day money-back guarantee, updates and support from the ProCom engineers who build it.