Custom order number in Magento 2 is a really beneficial feature. It can help you:
- Manage your store documents easily: With custom order numbers, you can change the number prefix to manage orders, shipments, invoices and other order documentation easier.
- Protect your business data from competitors: Customizing order numbers allow you to hide the real orders numbers from business competitors.
- Attract more customers: Customers are likely to buy from stores that have a lot of buyers, and they usually judge how high your sales volumes are by looking at the order numbers.
However, the native Magento numbering isn’t convenient enough.
Because of it, many merchants are finding a solution to make modifications to order numbers.
To help you customize the order number in your store, we decided to write this article to provide you with two tips to change the starting order numbers in Magento 2.
They are:
- Manually make changes directly in database: use code and commands to edit order increment ID, order number starts, and prefix
- Install an extension
We also RECOMMEND YOU READ >>> Improved Magento 2 Order Management Tips to better the order process on your site.
Tip 1: Make Changes to Magento 2 Order Number Directly in Database
First of all, you need to open your PHP Admin database. Then find and open the table “sales_sequence_profile.”
This is the structure of table “sales_sequence_profile”:

After that, you can make changes to the default order number on your Magento 2 website:
a. Magento 2 Change Order Increment ID
This is the guide to help you change the step between 2 continuous order numbers.
Step 1: Open Database and add the following SQL commands:
UPDATE ‘sales_sequence_profile’ SET ‘step’ = X WHERE ‘meta_id’ = 5;
Note: “meta_id” is gotten from table “sales_sequence_meta”

Step 2: Replace ‘X’ by the order you wish to make
Step 3: Run the query
b. Custom Order Number Prefix Magento
Following this structure for Magento 2 customize order number by adding the prefix to the order number:
Step 1: Go to Database and add the following SQL commands:
UPDATE ‘sales_sequence_profile’ SET ‘prefix’ = ‘X’ WHERE ‘meta_id’ = 5;
Step 2: Replace “X” with the order prefix you want.
Note: If you wish to disable prefix, remove the quotes and set x=NULL
Step 3: Run the query
c. Magento 2 Custom Order Number Suffix
Step 1: Go to Database and add the following SQL commands:
UPDATE ‘sales_sequence_profile’ SET ‘suffix’= ‘X’ WHERE ‘meta_id’ = 5;
Step 2: Replace “X” with the order prefix you want.
Note: If you wish to disable suffix, remove the quotes and set X=NULL
Step 3: Run the query
d. Change Order Number Start-value Magento 2
Step 1: Go to Database and add the following SQL commands:
UPDATE ‘sales_sequence_profile’ SET ‘start_value’= X WHERE ‘meta_id’ = 5;
Step 2: replace “X” with the number you wish to make.
Step 3: Run the query
e. Change Pad-length
The constant DEFAULT_PATTERN is set in: /vendor/magento/module-sales-sequence/Model/Sequence.php, line 22.

To avoid editing module core, you can change this in a custom module by creating etc/di.xml with the following contents:

After setting, you will get a new custom order number like this:
order_number = prefix + ((sequence_value – start_value) * step + start_value) {padded to X digits} + suffix
For example, you set: – step = ‘10’’ – prefix = ‘Bss-’ – suffix = ‘-M2’ – start_value = ‘1’ – DEFAULT_PATTERN = “%s%’.03d%s”
And last sequence_value = 2 => next sequence_value = 3
Then next order number is Bss-021-M2
Note: sequence_value is gotten from table “sequence_order_1”
Tip 2: Use Magento 2 Custom Order Number extension
GO TO PRODUCT PAGE >>> Magento 2 Custom Order Number extension to change order number as wished.
The damage of using code is that it directly intervenes in the database, which may cause harm to your website especially for those who do not get familiar with it. Hence, another tip to change order number simply safely is to use the support of a convenient extension.
And hereby we want to recommend you to use Magento 2 Custom Order Number extension.
The extension is very user-friendly so admins can change the order number. This module also allows you to cusom invoice number, credit memo number and shipment number at ease.
Another plus point is that you can edit the sale numberings individually for each store view.

This extension will bring you the best convenience of sales and customer management as well as data security.
Highlight features:
- Create a unique format for order numbers as you want
- Set number start, increments, and number padding
- Reset counter manually or configure to reset daily, weekly, monthly, yearly automatically
- Change also the invoice, shipment, and credit memo number
- Support multiple store views
FOR MORE INTERESTS: explore our Magento 2 B2B plugins if you plan to build a wholesale business.
Conclusion
In conclusion, you can completely implement Magento 2 order number customizations by making changes right in the database or use Magento 2 Custom Order Number extension. I highly recommend you to use the second choice as it does not directly interfere with the database. We hope it helps!
Apart from the extension itself, we offer FREE Installation | FREE 1-year Support | FREE Lifetime Update.
CONTACT US NOW for more information.
About BSS Commerce:
We are one of the leading Magento extension providers and web development services in the world. With experienced and certified Magento developers, we commit to bring high-quality products and services to optimize our business effectively. Let us know about your problems. We are willing to support you every time.
BSS Commerce is one of the leading Magento extension providers and web development services in the world. With experienced and certified Magento developers, we commit to bringing high-quality products and services to optimize your business effectively. Furthermore, we offer FREE Installation – FREE 1-year Support and FREE Lifetime Update for every Magento extension.
CONTACT NOW to let us know your problems. We are willing to support you every time.
excellent tips… helpful information you shared and wrote. Thanks for the article.
Thanks for the tutorial! However there is a little mistake when your first mention the table
sale_sequence_profile there is the ‘s’ in sales missing.
Hi Tobias,
Thank you for your suggestion. We corrected the table name.
Hope to keep updated with useful tutorials in the future!
Correct table name: sales_sequence_profile
Hi Matthias,
Thank you for your suggestion. We corrected the table name.
Hope to keep updated with useful tutorials in the future!