Magento Order Number

By default, in Magento the order number starts from 100000001. But if you need to:

  • mask the real order data from your customers and competitors,
  • reduce the increment_id tricks for multiple store views,
  • customize order numbers for inner purposes, etc.
you have two ways: 
1. Manually configure order numbers,
2. Use an extension that can do this job for you.
Here is how to change the order number manually.

To avoid confusion, Magento offers 2 different values of sales orders: entity_id & increment_id.

  • Entity_id (aka order_id) is used for internal purpose only. It is the sales_flat_order table primary key value, which connects all the eav tables together. Generally it starts from the value 1.
  • Increment_id (aka order_increment_id) is displayed to customers. This is the only id you need to use and change.

Note! In the increment_id the number of zeros is variable. So you can customize the order number length as you need.

Magento order number

How to modify the Increment_id?

Once an order is complete, jump to the sales_flat_order table, choose the necessary order and hit the edit link.

You can also change the prefix value of the future orders, invoices, shipments or credit memos in the eav_entity_store table.

*Increment_prefix defines which prefix will be added the order number (by default it’s 1).

Just select the necessary entity_type_id (5, 6, 7 or 8) and hit the edit button.

5 - Orders;
6 - Invoices;
7 - Credit Memos;
8 - Shipments.

order number Magento

Note! The entity_type_id number can vary in different database systems.

How to change the order starting number.

In the Insert tab change the increment_prefix value to the one you need. In our case, we have changed it from 1 to 17.

how to change order start number Magento

Magento change order start number

On the front-end it will look like this:

Magento order number

Magento Custom Order Number

Create a new Magento file, for example change.php and insert the following code there:

Replace $orderId = 237 with the real entity_id from your store that you need to change. When done, place this file into your Magento root folder, save it and open with [base_url]/change.php.

Please take a look at plugin that allows to manage orders easily

There are no products matching the selection.



posted on Nov 26, 2019
Thank you for this very useful tutorial. Bless you!

Submit Comment

* Required Fields