UPCOMING: Magento 2 Bootcamp of four days in The Netherlands (April 29th - May 2nd)

February 12, 2010

Changing the ordernumber in Magento

Yireo Blog Post

When moving to Magento, some people might want to change the default ordernumber 000000001 to some other number - either fooling the customer into thinking this is a very popular shop, or when migrating from another webshop to Magento. Here's how to change that order number.

MySQL table eav_entity_store

New ordernumbers are determined by a value called the increment_id, and this increment_id is stored in the database table eav_entity_store. You should login to the MySQL database using a program like phpMyAdmin, and then you will be able to edit the contents of this table.

If the database table is empty, this means that the system has not created any orders yet. Instead of trying to hack the database, it's best to create a fake order. To create a fake order you will also need to create a customer and a product, so it's probably best to perform this task just before you're going live with your shop.

Changing which increment_id?

Once you have completed orders, the table eav_entity_store will contain various records, and every record contains a different increment_id. The logic here is that increment_ids are used by various Magento entities, like orders and customers. In a default situation the record for customers has an entity_type_id of 2, while orders have an entity_type_id of 11. So to change the ordernumber for orders, you will need to edit the row with entity_type_id 11.

If you really want to know the IDs used for the different entities in the Magento database, take a look in the database table eav_entity_type, which lists various parts of an entity (like underlying PHP-classes and other MySQL tables).

What can you do with the ordernumber?

We recommend not changing the length of the ordernumber, nor the starting number of the increment_id (which should be the same as the increment_prefix) in the same table. But you can easily change some of the zeroes into other numbers.

Note that this will not change any data already stored in the database.

Posted on February 12, 2010

About the author

Author Jisse Reitsma

Jisse Reitsma is the founder of Yireo, extension developer, developer trainer and 3x Magento Master. His passion is for technology and open source. And he loves talking as well.

Sponsor Yireo

Looking for a training in-house?

Let's get to it!

We don't write too commercial stuff, we focus on the technology (which we love) and we regularly come up with innovative solutions. Via our newsletter, you can keep yourself up to date on all of this coolness. Subscribing only takes seconds.

Do not miss out on what we say

This will be the most interesting spam you have ever read

We don't write too commercial stuff, we focus on the technology (which we love) and we regularly come up with innovative solutions. Via our newsletter, you can keep yourself up to date on all of this coolness. Subscribing only takes seconds.