Complete-Tutorial-Guide-to-Change-Order-Number-in-Magento-2

“A” Complete Tutorial Guide to Custom Order Number in Magento 2

by admin

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

How-to-Enhance-Order-Management-in-Magento-2

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”:

magento-2-custom-order-number

“sales_sequence_profile” table

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”

magento 2 change order increment id

“sales_sequence_meta” table

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’ = ‘XWHERE ‘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’= ‘XWHERE ‘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.

magento-2-custom-order-number

Default path-length

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

magento-2-custom-order-number

Creating etc/di.xml

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

ustom-order-number-m2

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.

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.

magento-2-custom-order-number-extension

Magento 2 Custom Order Number extension configuration

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. I highly recommend you to use the second choice as it does not directly interfere with the database. We hope it helps!

magento-2-custom-order-number-extension

 

Apart from the extension itself, we offer FREE Installation | FREE 1-year Support | FREE Lifetime Update.

About BSS Commerce:

We are one of the leading Magento 2 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.

NEW: We have launched Trello’s Product Roadmap to keep you updated on our latest product versions. Share your feedback and suggestions for Magento solutions to help us improve your experience here. With our Product Roadmap, you can also request updates or compatibility for your desired modules or suggest a new one to enhance your website.
>>
Explore NOW! 

Next Reading Suggestions

© 2019 BSS Commerce owned by THANH CONG INTER ., JSC. All Rights Reserved.
Business registration certificate no. 0106064469 issued by Hanoi Department of Planning and Investment on 19 December 2019.
Legal Representative: Mr. Nguyen Quang Trung.