>How to customize order ID?

How to customize order ID?

Your store is new coming, which has just processed only some orders and you don’t want your customers to know the number of order placed? Do you want to have a custom order number which is just found in your online store? The all above problems can be solved merely by changing the order number. However, how can we customize the order ID when by default, Magento creates order number value starting with 100000001 and up? In this blog, I would like to show you some tips to change the order number in Magento.

TIP 1: MAKE CHANGES DIRECTLY IN DATABASE

First and foremost, you need to know the current increment order ID. To do so, you have to add SQL to database:

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
INNERJOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id
INNERJOIN core_store ON core_store.store_id = eav_entity_store.store_id
INNERJOIN core_store_group ON core_store_group.group_id = core_store.group_id
INNERJOIN 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;

When you combine this SQL to a database, all current increment ID of not only orders but also quotes, invoices, shipments, and credit memos will be displayed. Even when you have some stores, it is unnecessary to worry about updating a store because this will show both the website and store name and ID for each type of increment ID.

This will display your current increment ID and prefix for all document types (quotes, orders, invoices, shipments, and credit memos). Besides, it will show you the website group, website name, store name, and store ID for each type of increment ID to help you in updating a specific store among multiple stores.

NOTE:

+ increment_prefix field type: varchar(20)

+ increment_last_id field type: varchar(50)

Now, let’s see how to change increment order ID:

Case 1: Change order increment ID in all stores

a. Change Order increment ID

To make a change to order increment ID in the scope of all stores, you have to:

Step 1:  Go to Database and add the following SQL commands.
UPDATE eav_entity_store
INNERJOIN 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';

Step 2: Replace ‘xxxxxxxxxx’ by the order you wish to make
Step 3: Run the query
b. Change Order Prefix
Step 1:  Go to Database and add the following SQL commands.
UPDATE eav_entity_store
INNERJOIN 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';

Step 2: replace “X” with the order prefix you want.

NOTE: If you wish to disable prefix, remove the quotes and set x=NULL

Step 3: Run the query

Case 2: Change order increment ID in a specific store

a. Change order increment ID
Step 1: Go to Database, add the following SQL commands
UPDATE eav_entity_store
INNERJOIN 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='orderAND eav_entity_store.store_id ='Y';

Step 2: Replace ‘xxxxxxxxxx‘ with your desired order ID; ‘Y‘ with desired store ID
Step 3: Run the query
b. Change Order Prefix
Step 1: Go to Database and add the following SQL commands
UPDATE eav_entity_store
INNERJOIN 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='orderAND eav_entity_store.store_id ='Y';

Step 2: Replace ‘X‘ with your wanted prefix, ‘Y‘ with Store ID of the store you wish to change the order in.

NOTE: Similarly to prefix in the first case, you can entirely remove the prefix by removing the quotes and setting x=NULL

Step 3: Run the query

TIP 2: USE MAGENTO CUSTOM ORDER NUMBER EXTENSION

One straightforward advice to change order number is to use the support of a useful extension called Magento Custom Order Number. The merit of using this extension is that it does not directly intervene in the database, which may cause harm to it especially for those who do not get familiar with it. Besides, the extension is very user-friendly so admins can make changes to order number at ease. One more pros of this extension is that you can not only make a difference to order ID but also shipment, credit memo, and invoice number.

Give it a TRY!

In conclusion, you can completely customize order numbers by making changes right in the database or use Magento Custom Order Number extension. I highly recommend you to use the second choice as it does not directly interfere with the database. Hope this helps!