How to Change Magento 2 Order Number

How to Change Magento 2 Order Number: A Comprehensive Guide

by admin

Custom order number is a really beneficial feature. It can help you:

  • Manage your store documents easily: With custom order numbers, you can change Magento 2 order number prefix to manage orders, shipments, invoices, and other order documentation more easily.
  • Protect your business data from competitors: Customizing order numbers allows you to hide the real order 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 this, many merchants are finding a solution to make modifications to order numbers. This article will show you some ways to change the order number in the Magento 2 store. EXPLORE NOW!

How to Change Magento 2 Order Number: 2 Ways to Consider

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 the database: use code and commands to edit order increment ID, order number starts, and prefix
  • Install a Magento 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:

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

Magento 2 Change Order Increment ID Prefix

Following this structure for Magento 2 customize the 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 the prefix, remove the quotes and set x=NULL

  • Step 3: Run the query

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 the suffix, remove the quotes and set X=NULL

  • Step 3: Run the query

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

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 the 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 Magento 2 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 numbers 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 the counter manually or configure it to reset daily, weekly, monthly, and yearly automatically
  • Change also the invoice, shipment, and credit memo number
  • Support multiple store views

>>> FOR MORE INTERESTS: explore our Magento 2 B2B extensions package 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 our guide on how to change Magento 2 order number can significantly enhance your operational efficiency and customer satisfaction by tailoring order numbers to meet their specific needs.

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 the top-notch Magento 2 extension provider and Magento eCommerce development company in the world. With experienced and certified Magento developers, we commit to bringing high-quality products and services to optimize our business effectively. Let us know about your problems. We are willing to support you every time.

READ MORE: The Ultimate Magento 2 Tutorial for Beginners

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.