How to Change the Order Increment ID and Prefix in Magento

Here and there the need emerges where you should change the Magento request numbering. Maybe it is important to keep away from strife with a different Magento establishment or other ecommerce stage. On the other hand possibly you simply need to expand your request number to appear as though you've prepared a huge number of requests. Whatever the case might be here are some SQL orders you can rushed to check the status of your store's request numbers, and charges to likewise change the numbering. Furthermore, I've included SQL charges to change the receipt, shipment, and acknowledge update increase IDs too.

Find the Current Increment IDs for All Stores

SELECT core_store_group.name AS group_name, core_website.name AS website_name, core_store.name AS store_name, core_store.store_id, increment_prefix, increment_last_id, entity_type_code
FROM eav_entity_store
INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
INNER JOIN core_store ON core_store.store_id = eav_entity_store.store_id
INNER JOIN core_store_group ON core_store_group.group_id = core_store.group_id
INNER JOIN core_website ON core_website.website_id = core_store.website_id
WHERE eav_entity_store.store_id != 0 ORDER BY eav_entity_store.store_id;

Change your Order Increment ID on All Stores

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='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='order';

Replace the X‘s with your desired order number and run the query.

Change your Order Prefix on All Stores

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_prefix='X'
WHERE eav_entity_type.entity_type_code='order';

Replace the X with your desired order prefix or remove the quotes and set X to NULL (no quotes) to disable the order prefix, then run the query.

Change your Order Increment ID on a Specific Store

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='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='order' AND eav_entity_store.store_id = 'Y';

Replace the X‘s with your desired order number, replace Y with the store ID of the store you want to modify, then run the query.

Change your Invoice Increment ID on All Stores

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='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='invoice';

Replace the X‘s with your desired invoice number and run the query.

Change your Shipment Increment ID on All Stores

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='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='shipment';

Replace the X‘s with your desired shipment number and run the query.

Change your Credit Memo Increment ID on All Stores

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='XXXXXXXXXX'
WHERE eav_entity_type.entity_type_code='creditmemo';

Replace the X‘s with your desired credit memo number and run the query.