Custom Order Numbers in Magento 2: Prefixes, Dates & Counters
Custom order numbers in Magento 2: small field, real consequences
Magento's default order numbers are sequential and predictable: 000000001, 000000002… That leaks trade information — anyone who orders twice can estimate your monthly volume from the gap — and looks generic on invoices. Renaming the sequence is also genuinely useful operationally: per-store prefixes, a year marker, and matching invoice/shipment/credit-memo numbers make documents instantly identifiable in accounts and support conversations.
What you can't do natively
Magento Open Source offers no admin control over the order number format. The sequence lives in database tables (sales_sequence_*), and while a developer can nudge the counter or padding there, there's no supported way to add prefixes, date parts, or different formats per store view — and hand-editing sequence tables on a live store is a good way to break order creation.
What Custom Order Number adds
Our Custom Order Number for Magento 2 module puts the format in Stores > Configuration: a template with prefix, date variables and counter (e.g. AE-{yyyy}-{counter}), counter start/increment/padding, optional periodic counter reset, per-store-view formats, and the option to apply the same scheme to invoices, shipments and credit memos so all documents for one order share a recognisable number.
Two things to know before switching
- Existing orders keep their numbers — the format applies from the change onward; history is untouched.
- Keep uniqueness in mind — if you reset counters periodically, include a date part in the template so numbers can never collide.
Frequently asked questions
Can I change the order number format in Magento 2 without a module?
Not through the admin. Developers can alter padding/counters in the sequence tables, but formats with prefixes or dates need code — or a module.
Do payment gateways care about the format?
Gateways treat the increment ID as an opaque string; standard prefixes/dates cause no issues. Keep it to letters, numbers and hyphens.
Does it work per store view?
Yes — each store view can carry its own format, useful for multi-brand installs. Verified on Magento Open Source 2.4.9, PHP 8.4 and 8.5.
Custom Order Number is a one-off purchase — no subscription — and is included in the AgenticEcom Suite.
