“A” Complete Tutorial Guide to Change Magento 2 Order Number!

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

“A” Complete Tutorial Guide to Change Magento 2 Order Number!

Because of the limitation of order number in default Magento 2, many merchants are finding a solution to make modifications to order number. You can customize Magento 2 order number. In this article, we’ll provide you with some tips to change the default Magento 2 order number in the correct way, 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

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 “sale_sequence_profile.”

This is the structure of table “sale_sequence_profile”:

magento-2-custom-order-number
“sale_sequence_profile” table

After that, you can make changes to 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. Magento 2 Custom Order Number Prefix

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. Magento 2 Change Order Number Start-value

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

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. You can refer Magento 2 Custom Order Number extension. The extension is very user-friendly so admins can make changes to order numbers at ease. This module not only allows you to make Magento 2 change order number but also shipment, credit memo, and invoice number. One 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

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!

magento-2-custom-order-number-extension

 

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.

Write A Comment

Name

( 1 ) Comment

  • Jina

    excellent tips… helpful information you shared and wrote. Thanks for the article.