Custom Order Numbers in Magento 2: Pros vs Cons and the Database Modification vs Extension Debate

When is changing the default Magento 2 order numbering system useful - or not useful? Should you change the order/invoice number via database modification or install an extension to do the job?

We take a look at the options for Magento developers below.

Reasons to Customise Your Magento 2 Order Numbers

Custom order numbers in Magento 2 may not be as glamorous or exciting as marketing or B2B when it comes to “must-have” e-commerce features. But there are actually some pretty good reasons why you should consider a custom invoice number.

Custom order numbers can add value and insight in surprising ways. Here’s why you should consider changing the default Magento 2 invoice numbering system on your next client project.

1. Get rid of the excess padding

A big reason Magento agencies and merchants choose custom order numbers is simply for aesthetics and user-friendliness. Default Magento 2 order numbers are loooong. The standard 9 digits is just too many 0’s for most businesses. Changing order #100000987 to a more streamlined order #987 makes order numbers easier to read and recognise.

2. Easy financial year record-keeping and compliance

Custom order numbers can help you keep track of how many orders you receive in a given timeframe, such as a financial year or month. With an order number like #2021-1745, you can see instantly that you had 1745 orders in the 2021 financial year. The counter would automatically reset for the 2022 financial year, starting again at #2022-001. It’s an easy way to comply with local customs and regulations for invoicing requirements.

3. Instantly see the order date, time and other important information

Default Magento 2 order numbers don't provide any useful information about the order - but custom order numbers can. By adding custom times and dates to your order numbers, you can instantly see when an order was placed. Adding other information like store, country or a custom identifier will tell your team important details they need to know, without having to look up order details in the Magento 2 backend. This information lets you understand if a customer is within a certain return or support period, where they ordered from or anything else - just by looking at the order number.

4. Easily identify orders from different Magento multi-stores

Operate a multi-store set-up? Then custom order numbers are a must. Add a prefix or suffix for your wholesale (#WS1089) and retail stores (#RT5690). Or if your multi-stores are set up per country, order #8870-Fr (for your French store) will give you a lot more insight than plain old order #3000008870.

5. Quickly identify shipment and credit memo numbers

By using a custom prefix or suffix, you can clearly identify whether a number relates to a Magento 2 order, invoice, shipment and credit memo. #SHIP-1251 or #CREDIT-1033 are much easier to identify as shipment and credit records than the default number #10001033. This saves you having to look up an order in the backend.

6. Make your invoice, shipment and credit memo numbers match the order number

You can change your Magento 2 order number system so that all records associated with a single order take the same reference number. Order #451 will have associated Invoice #451, Shipment #451 and Credit Memo #451, rather than these all having different numbers. Single reference number record keeping makes things much less confusing for your team. We released a popular free Same Order Invoice Number Magento 2 extension which does just this.

7. Moving to Magento 2 from another platform or system

New to Magento 2? Set a custom order number to continue your numbering system from the old platform. Moving from Shopify? Your last Shopify order #3401 can continue on to your first order #3402 in Magento 2 - easy.

8. Smoother customer support

Shorter order numbers can make customer support just that extra bit simpler. Your support staff, customers and shipping providers are busy and do not want to read out 9 digit order numbers over the phone! For Fooman’s own customer support, we rely on custom dated order numbers to quickly see when a customer purchased an extension and save us admin time. This helps us see whether they’re within their support period without having to link to other systems or manually look up orders in Magento.

9. Hide your order volumes from customers… and the competition

With default Magento numbers, it’s not hard to predict sales volumes using standard increment order numbers. It’s also easy to identify when an ecommerce store is brand new, which can impact customers' trust in a store.
Custom order numbers mean you can start orders at #1020 or #10201 - not #100000001. No-one needs to know it’s your very first order. Setting random increments is another way to make it harder for customers or the competition to guess sales volumes from your numbering system.

Reasons Not to Use Custom Order Numbers in Magento 2

Here are a few reasons where it might not make sense to change Magento's numbering system for your next client build.

1. You or your customers export Magento 2 orders to a separate system for processing

A third party system may not be able to understand custom order numbers. For example, the system might only read numbers but not letters.

2. You’ve been asked to change historical order number data

A good custom order number extension will only allow you to change future order numbers - not historical data. It’s never a good idea to change historical order information for tax and legal reasons.

3. Your client doesn't mind the default numbering system

Not all clients have custom needs when it comes to order numbers - plenty are happy using the standard #100000987, and don't see much value in changing to something more insightful. Small merchants in particular might not mind - but they may want to place some initial test orders, so their real customers don't discover they are in fact the first and only customers of the store (which could limit people's trust and brand perception).

How Should I Change Magento 2 Order Numbers - Database Manipulation or Extension Code?

As extension developers, we are obviously big believers in using extensions as a time (and risk) saving tool. But our Twitter poll showed that some developers still prefer customising order numbers manually, via database manipulation.

Let’s look at the pros, cons and how-to of both database manipulation and using extension code as a way to change Magento 2 invoice numbers.

Direct Database Manipulation

How to do it

It's possible to create custom order numbers via direct database manipulation in Magento 2. It’s more difficult than it was for Magento 1, but it is possible.

Classy Llama have a pretty good guide on how to change the Magento 2 increment ID for orders, invoices, shipments and credit memos. They cover the order number prefix, suffix, step, start value and pad length. This article is the most comprehensive resource we've come across and it’s well worth a read.

There are also a few helpful Magento StackExchange tutorials which deal with specific order number database changes in Magento 2. We haven’t personally tested the suggestions, but if you’re looking for ideas then the up-voted suggestions could be a good place to start:


You don’t need to spend time looking for a suitable extension, and you might be able to generate income by charging customers for the development time you spend on the database modification. You’ll also avoid paying the cost of the extension license when you modify code directly.


There are a few major downsides to direct database manipulation. The process is one-off and not repeatable. It’s unfortunately error-prone, hard to test and therefore not great Magento 2 coding practice. You really need to know what you’re doing, or risk digging a mess that causes an unintended error later on.

Extension Code

How to do it

Install your chosen extension and set new custom order, invoice, shipment and credit memo numbers via the backend settings. Here's an example of the Fooman Order Number Customiser backend settings.

The backend settings are supported by flexible {} commands and the live preview displays how your final order number will appear.

You want to look for a lightweight extension without excess feature bloat - something that adds only the functionality needed to change order numbers, to lower the potential for conflicts elsewhere.


A well-coded extension saves you the time and risk of having to make manual database code modifications. As well as saving a few hours of research and coding, a well thought-out extension will have tested dozens of edge use cases (like this testing curveball) and potential conflicts you might not have thought about.

The backend settings added by an extension will also give your customers more flexibility. They can decide to change their invoice number system themselves in the future as their business evolves.

Plus, if there is ever a new Magento 2 version or security patch released which impacts on order number functionality, you know that a reputable extension provider will release a compatibility update to save you the headache of manually testing code and database changes against each new version.


An extension is a paid investment, and requires a license to be purchased for each customer you use it for. You do need to spend some time choosing the right extension and reviewing the code quality before installing it - but you only need to do this once, and then can use the same extension for different customers.

Fooman Order Number Customiser

If you’ve read this far and decided that a custom order number extension is right for you, then make sure you consider Fooman’s Order Number Customiser Magento 2 extension.

It’s an easy, trusted way to change Magento 2 order, invoice, shipment and credit memo numbers. Set-up is quick and easy, with options for prefix/suffix, order date/time, custom increments, padding/order number length, multi-store settings and automatic duplicate separation. The rock solid code is supported by automated testing frameworks, and is trusted by Magento 2 agencies plus global brands like MakerBot and Trilogy.

Try the extension demo today.

Kristof Ringleff

Kristof Ringleff

Founder and Lead Developer at Fooman

Join the Fooman Community

We send our popular Fooman Developer Monthly email with Magento news, articles & developer tips, as well as occasional Fooman extension updates.