16

Is there any way to change Order Starting Number in Magento without changing order numbers that are already there? I just want to set 170000xxxx for all new orders.

Thanks

2

4 Answers 4

32

Look in eav_entity_store and find increment_last_id. Update this number, making sure that entity_type_id is correct for orders.

Find the entity_type_id for orders

SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'order';

2
  • I guess entity type id for order is always 4 or one should at least match the last order number with the value in increment_last_id.
    – atif
    Sep 16, 2013 at 7:11
  • The entity_type_id for "order" for my installations always seems to be 5. I would use the query given above to always check what the correct id is for a given installation. Nov 7, 2015 at 17:52
5

Sankar had it almost right

UPDATE `database`.`eav_entity_store` SET `increment_last_id` = '17000000' WHERE `entity_store_id` = 1;
1
  • No.. He got it wrong, advising it's the store ID. It should be the Order entity ID. See first comment to Sankar's answer.
    – justabuzz
    Aug 25, 2016 at 3:19
5

The simplest solution for this is to use Ashley Schroder's "Set Custom Order Number" extension. This extension, once installed, makes changing the next order number a simple operation you can do through the back end.

Regardless of the method used, make sure your new order number sequence doesn't include existing orders, otherwise bad things happen (unique constraints in the database not satisfied, Magento crashes).

2
3
UPDATE `eav_entity_store` SET `increment_last_id` = '30000000' WHERE `entity_type_id` = STOREID;`

STOREID -> The store id which you are using.

1
  • 2
    This is incorrect. You are conflating entity_type_id and store_id. I believe you meant to say something along the lines of: UPDATE eav_entity_store SET increment_last_id = '30000000' WHERE entity_type_id = (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'order'); Apr 27, 2014 at 21:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.