Thursday, November 21, 2024

How To Change Order Prefix And Default Value Of Order/Shipment/Invoice Number/Credit Memo In Magento

1 comment 105 views

As you have by now set your own magento store and you see that the order number a customer gets after purchasing starts from 100000001. But as its your new store and you don’t want your store to look like an amateur to others, you thought of changing the value of the order/shipment/invoice/credit memo number. But as you might have found out that there is no option in magento to change the value of this. Also it occurred to you that you want to modify in a way that it has a prefix related to your store name. e.g. Your store name is BestBooks.com, so you want that your order number looks like BB10023123. It looks definitely better than the default.

Change_Order_Prefix_Value_Magento

So I would now like to proceed to show you how its done.

[alert]You must back up your complete website including database first. Also try this on your demo website first to see whether your live website would accept it.[/alert]

[alert variation=”alert-success”]This has been tested on Magento Community Edition v 1.6.2.0 and 1.7.0.2. So it will probably work for the later versions also.[/alert]

How to find your store’s current order/shipment/invoice /credit memo number

  •  Login to the Cpanel and go to phpMyAdmin
  •  Select the database in which your magento installation is running.
  •  Go to SQL.
  •  Run the codes.
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;

[alert variation=”alert-error”]When making changes keep in mind that the increment_prefix field type is varchar(20) and that the increment_last_id field type is varchar(50)[/alert]

Now the changing part

 

Change The Order Number And Prefix

Change order number value (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';

[alert variation=”alert-info”]Change the “XXXXXXX” in the above code to whatever you want e.g. 10023423 and press Go[/alert]

 

Change the order prefix (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';

[alert variation=”alert-info”]Change the “X” in the above code to whatever you want e.g. BB and press Go. Set X to NULL (no quotes) to disable the order prefix, then run the query.

DO NOT set the increment prefix to NULL on anything less than v1.6.0[/alert]

 

Change order number value (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';

[alert variation=”alert-info”]Change the “XXXXXXX” in the above code to whatever you want e.g. 10023423 and replace Y with the store ID of the store you want to modify. The press Go.[/alert]

 

Change the order prefix (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_prefix='X'
WHERE eav_entity_type.entity_type_code='order' AND eav_entity_store.store_id = 'Y';

[alert variation=”alert-info”]Change the “X” in the above code to whatever you want e.g. BB and press Go. Set X to NULL (no quotes) to disable the order prefix. Replace Y with the store ID of the store you want to modify, then run the query.

DO NOT set the increment prefix to NULL on anything less than v1.6.0. [/alert]

[button type=”button” size=”btn-medium” variation=”btn-danger” block=”btn-block”]BEFORE[/button]

change_order_number_magento [button type=”button” size=”btn-medium” variation=”btn-inverse” block=”btn-block”]AFTER[/button]

change_order_number_magento2

 

Change Invoice Number and Prefix

Change Invoice number value (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';

[alert variation=”alert-info”]Change the “XXXXXXX” in the above code to whatever you want e.g. 10023423 and press Go[/alert]

 

Change the Invoice prefix (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='invoice';

 [alert variation=”alert-info”]Change the “X” in the above code to whatever you want e.g. BB and press Go. Set X to NULL (no quotes) to disable the order prefix, then run the query.

DO NOT set the increment prefix to NULL on anything less than v1.6.0[/alert]

 

Change Invoice number value (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='invoice' AND eav_entity_store.store_id = 'Y';

[alert variation=”alert-info”]Change the “XXXXXXX” in the above code to whatever you want e.g. 10023423 and replace Y with the store ID of the store you want to modify. The press Go.[/alert]

 

Change the Invoice prefix (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_prefix='X'
WHERE eav_entity_type.entity_type_code='invoice' AND eav_entity_store.store_id = 'Y';

[alert variation=”alert-info”]Change the “X” in the above code to whatever you want e.g. BB and press Go. Set X to NULL (no quotes) to disable the order prefix. Replace Y with the store ID of the store you want to modify, then run the query.

DO NOT set the increment prefix to NULL on anything less than v1.6.0. [/alert]

 

Change Shipment Number and Prefix

Change Shipment number value (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';

 [alert variation=”alert-info”]Change the “XXXXXXX” in the above code to whatever you want e.g. 10023423 and press Go[/alert]

 

Change the Shipment prefix (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='shipment';

[alert variation=”alert-info”]Change the “X” in the above code to whatever you want e.g. BB and press Go. Set X to NULL (no quotes) to disable the order prefix, then run the query.

DO NOT set the increment prefix to NULL on anything less than v1.6.0[/alert]

 

Change Shipment number value (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='shipment' AND eav_entity_store.store_id = 'Y';

[alert variation=”alert-info”]Change the “XXXXXXX” in the above code to whatever you want e.g. 10023423 and replace Y with the store ID of the store you want to modify. The press Go.[/alert]

 

Change the Shipment prefix (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_prefix='X'
WHERE eav_entity_type.entity_type_code='shipment' AND eav_entity_store.store_id = 'Y';

[alert variation=”alert-info”]Change the “X” in the above code to whatever you want e.g. BB and press Go. Set X to NULL (no quotes) to disable the order prefix. Replace Y with the store ID of the store you want to modify, then run the query.

DO NOT set the increment prefix to NULL on anything less than v1.6.0. [/alert]

 

[button type=”button” size=”btn-medium” variation=”btn-danger” block=”btn-block”]BEFORE[/button]

change_order_prefix_magento

[button type=”button” size=”btn-medium” variation=”btn-inverse” block=”btn-block”]AFTER[/button]

change_order_prefix_magento2

Change Credit Memo Number and Prefix

Change Credit Memo number value (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';

 [alert variation=”alert-info”]Change the “XXXXXXX” in the above code to whatever you want e.g. 10023423 and press Go[/alert]

 

Change the Credit Memo prefix (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='creditmemo';

[alert variation=”alert-info”]Change the “X” in the above code to whatever you want e.g. BB and press Go. Set X to NULL (no quotes) to disable the order prefix, then run the query.

DO NOT set the increment prefix to NULL on anything less than v1.6.0[/alert]

 

Change Credit Memo number value (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='creditmemo' AND eav_entity_store.store_id = 'Y';

[alert variation=”alert-info”]Change the “XXXXXXX” in the above code to whatever you want e.g. 10023423 and replace Y with the store ID of the store you want to modify. The press Go.[/alert]

 

Change the Credit Memo prefix (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_prefix='X'
WHERE eav_entity_type.entity_type_code='creditmemo' AND eav_entity_store.store_id = 'Y';

[alert variation=”alert-info”]Change the “X” in the above code to whatever you want e.g. BB and press Go. Set X to NULL (no quotes) to disable the order prefix. Replace Y with the store ID of the store you want to modify, then run the query.

DO NOT set the increment prefix to NULL on anything less than v1.6.0. [/alert]

 

[button type=”button” size=”btn-medium” variation=”btn-success” block=”btn-block”]RESULT[/button]

order_complete

[progress size=”97″ variation=”progress-success” striped=”progress-striped” animated=”active”]

That completes the tutorial about changing the values of order/shipment/invoice/credit memo and their prefixes.

1 comment

Perry June 5, 2015 - 1:01 pm

For those who is not a developer and need really quick solution there is a ready-made tool for changing the order and other documents numbers – Custom Order number from Amasty.

Reply

Leave a Comment


Search

About Me

Jane Taylor

Jane Taylor

Passionate interior designer who love sharing knowledge and memories.
More About Me

Newsletter

Subscribe To Our Newsletter for new blog posts, tips & ideas. Let's stay updated!

Top Selling Multipurpose WP Theme

About Us

The Vortex Code

The Vortex Code

Our mission is simple: to make complex concepts accessible, ignite curiosity, and inspire innovation through our blogs and tutorials.

Newsletter

Subscribe To Our Newsletter for new blog posts, tips & ideas. Let's stay updated!

© 2013-23 TheVortexCode. All Right Reserved.