Skip to content

Custom Order Numbers

Magento’s default order numbers (000000123) tell a customer — and you — nothing. Custom Order Numbers lets you design them: a prefix, the date, a padded counter, even the store or country — e.g. ORD-2026-01024 or UK-260615-00042. The same applies to invoices, shipments and credit memos, the counter can reset each day/month/year, and it’s all concurrency-safe with built-in collision protection.

Custom Order Number configuration

Magento

Open Source 2.4.9 GA (and later 2.4.x).

PHP

Tested on 8.4 and 8.5.

Documents

Order, invoice, shipment and credit memo — each its own format.

Safe

Race-safe period reset + duplicate-number guard.

Compose the number from literal text and tokens:

TokenBecomesTokenBecomes
{COUNTER}the padded sequence counter{YYYY} / {YY}year
{STORE_ID}the store view ID{MM} / {DD}month / day
{country_code}store default country{rand}random hex (uniqueness)
ORD-{YYYY}-{COUNTER} → ORD-2026-01024
{country_code}-{YY}{MM}{DD}-{COUNTER} → GB-260615-00042
INV-{YYYY}{MM}-{COUNTER} → INV-202606-00007

Set the counter behaviour separately:

SettingWhat it does
Start CounterThe first number (e.g. start at 1000 so numbers look established).
Pad LengthZero-pad the counter to a fixed width (501024).
Increment StepHow much the counter advances each order (e.g. 1, or 10).
Reset FrequencyNever, Daily, Monthly, or Yearly — the counter restarts at Start Counter each period.
Will two orders ever get the same number?

No. Numbers come from Magento’s atomic sequence (so the counter is always unique), and a collision guard double-checks each generated order number against existing orders and differentiates it if anything ever clashed — so duplicates can’t reach the database.

Can the counter restart each year (or month/day)?

Yes — set Reset Frequency. The first order of each new period restarts at your Start Counter, and the date tokens in the format always match the period, so ORD-2026-00001 rolls to ORD-2027-00001 cleanly on New Year’s Day.

Do invoices and shipments have to match the order number?

Your choice — give each document its own format, or tick same as order to reuse the order number on its invoice/shipment/credit memo.

Does it slow down checkout?

No. With reset set to Never there’s no extra database work at all, and even with a reset the overhead is a single indexed lookup. Verified clean on PHP 8.4 and 8.5.