Posted about 7 years ago. Visible to the public. Draft.

Set Next Increment ID For Orders, Quotes, Invoices, Shipments or Credit Memos

BIG NOTE! I'm not totally sure that all these entity types increment ID's are stored here any more. Check

The last order increment ID issued for all these entity types is stored in eav_entity_store, in the increment_last_id column. Note that this is the last ID, so if you wish your next ID to be 100065000, then you must set your increment_last_id to be 100064999. Also bear in mind that increment IDs are per store, so you need to decide which store you are updating the increment ID for, and find out the store ID.

Orders

Copy
UPDATE eav_entity_store INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id SET eav_entity_store.increment_last_id = '100064999' WHERE eav_entity_type.entity_type_code = 'order' AND eav_entity_store.store_id = 1;

Quotes

Copy
UPDATE eav_entity_store INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id SET eav_entity_store.increment_last_id = '100064999' WHERE eav_entity_type.entity_type_code = 'quote' AND eav_entity_store.store_id = 1;

Invoices

Copy
UPDATE eav_entity_store INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id SET eav_entity_store.increment_last_id = '100064999' WHERE eav_entity_type.entity_type_code = 'invoice' AND eav_entity_store.store_id = 1;

Shipments

Copy
UPDATE eav_entity_store INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id SET eav_entity_store.increment_last_id = '100064999' WHERE eav_entity_type.entity_type_code = 'shipment' AND eav_entity_store.store_id = 1;

Credit Memos

Copy
UPDATE eav_entity_store INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id SET eav_entity_store.increment_last_id = '100064999' WHERE eav_entity_type.entity_type_code = 'creditmemo' AND eav_entity_store.store_id = 1;

General Info

The table looks like the following:

| entity_store_id | entity_type_id | store_id | increment_prefix | increment_last_id |
+—————–+—————-+———-+——————+——————-+
| 1 | 1 | 0 | 0 | 000017379 |
| 2 | 11 | 1 | 1 | 100058797 |
| 3 | 16 | 1 | 1 | 100056714 |
| 4 | 23 | 1 | 1 | 100004946 |
| 5 | 11 | 2 | 2 | 200000503 |
| 6 | 16 | 2 | 2 | 200000493 |
| 7 | 23 | 2 | 2 | 200000113 |
+—————–+—————-+———-+——————+——————-+

entity_type_id
The type of the entity for which the increment relates. This is a foreign key which relates to eav_entity_type, and through it's foreign table relates to one of quote, order, invoice, shipment or creditmemo
store_id
Fairly obvious
increment_prefix
The first digit of the increment_last_id
increment_last_id
Fairly obvious

Owner of this card:

Avatar
Mike Whitby
Last edit:
over 5 years ago
Posted by Mike Whitby to Magento
This website uses cookies to improve usability and analyze traffic.
Accept or learn more