Web Development   Browse Topics

Change Magento 2 Order ID Increment (2.1.7)

Posted Jul 12, 2017 by Nick Vogt
Here is how you can change the order ID increment in Magento 2. This requires a minor edit to the database so should only be attempted by those familiar with database changes, and only after a backup. This works for Magento 2 version 2.1.7 and will probably work for similar versions and newer versions, but I can't guarantee it.

Step 1
Log into PHPMyAdmin for your Magento 2 MySQL database. I'm not going to cover how to do this as it varies with every host.

Step 2
Open up your Magento 2 database and find the table named sequence_order_1. There will probably be multiple other similarly-named tables, but those can be ignored.

Magento 2 Change Auto Increment ID

Step 3
Go to the Operations tab of the sequence_order_1 table, and find the field called AUTO_INCREMENT in the "Table options" box.

Magento 2 Change Auto Increment ID

Update this to your desired order ID increment value. Your new value must be higher than what it was originally.

Why 101252187?
In the screenshot above you can see that I changed the auto increment to 101252187. This ID increment number was chosen specifically for three reasons:

  1. Magento prefills in zeros if the order ID has fewer than 9 digits.
  2. The order ID should start with a non-zero, so it isn't shortened when exported into Excel or another program. For example: Order ID "000002187" would become "2187" in Excel by default without preemptively changing row format.
  3. There should never be more than a few zeros next to each other in an ID, since it makes it very difficult to see at a glance. Compare "100002187" to "101252187".
Share This Post
Facebook Twitter


Share This Post
Facebook Twitter
H3XED © Nick Vogt   RSS   Privacy Policy   Facebook   Twitter   Google+