How to Change Order Starting Number in Magento

36,580

Solution 1

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';

Solution 2

Sankar had it almost right

UPDATE `database`.`eav_entity_store` SET `increment_last_id` = '17000000' WHERE `entity_store_id` = 1;

Solution 3

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).

Solution 4

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

STOREID -> The store id which you are using.

Share:
36,580
FlourishDNA
Author by

FlourishDNA

Updated on August 16, 2020

Comments

  • FlourishDNA
    FlourishDNA over 3 years

    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

  • atif
    atif over 10 years
    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.
  • Matt Pavelle
    Matt Pavelle about 10 years
    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');
  • Junaid Bhura
    Junaid Bhura over 9 years
    Looks like that extension has been deleted. Here is another extension which lets you change your order numbers along with other options: magentocommerce.com/magento-connect/…
  • Jim OHalloran
    Jim OHalloran over 9 years
    It's still available directly from Ashley's web site... aschroder.com/category/set-start-order-number-extension Link updated.
  • Doug Knudsen
    Doug Knudsen over 8 years
    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.
  • justabuzz
    justabuzz over 7 years
    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.