Shortening Increment ID length for Orders, Invoices, and Shipments
We recently had a client who needed to shorten the default Magento Increment ID length from the default 9 characters (eg 100000000) to 6 characters. This can be accomplished by modifying the “increment_pad_length” in the “eav_entity_type” for whatever entity you’re wanting to modify. Here is a screenshot of the resulting table:
If you’re wanting to change the number from which Magento starts counting orders/invoices/shipments, or wanting to change the prefix for those entities, check out this great post by Timothy at Elias: http://eliasinteractive.com/blog/magento-ecommerce-how-to-reset-all-test-order-information-and-set-unique-prefix-for-orders-invoices-shipments-and-credit-memos/
This entry was posted on Saturday, October 3rd, 2009 at 9:01 pm and is filed under Magento Development. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

November 29th, 2009 at 7:22 pm
Hi,
I posted this on the Magento forum just now as well. I followed the directions here to change the default 8 characters for invoice to 7, and I don’t think it worked for me. My credit card extension only allows 7 characters in the invoice field. So I changed invoice, invoice_item, and invoice_comment under the entity_type_code in my database to 7. I’m still getting an error when I try to post an order that says: “Declined: Field Format Error.” Any suggestions on this?
December 28th, 2009 at 4:28 pm
You should take a look in your sales_order_entity and look for rows with their entity_type_id equalling 16. If the increment_id field is 7 characters, then the directions worked.
September 29th, 2010 at 1:02 pm
Hmm. You know, this didn’t work for us. Do we need to truncate the test orders table first and work with a clean slate? Or do I need to update the last number with the proper length as well for it to work?
November 18th, 2010 at 7:50 am
Use this, manually editIng won’t work:
update `eav_entity_type` set `increment_pad_length`=6 where `entity_type_code`=’order’;
January 20th, 2011 at 5:46 am
This worked for me:
UPDATE `eav_entity_type` SET `increment_pad_length`=4 WHERE entity_type_code = ‘order’;
UPDATE `eav_entity_type` SET `increment_pad_length`=4 WHERE entity_type_code = ‘creditmemo’;
UPDATE `eav_entity_type` SET `increment_pad_length`=4 WHERE entity_type_code = ‘invoice’;
UPDATE `eav_entity_type` SET `increment_pad_length`=4 WHERE entity_type_code = ’shipment’;
January 20th, 2011 at 5:53 am
Should have said we are on 1.4.1.1
June 6th, 2011 at 5:36 am
Is better if you can avoid to use an SQL request in an installer
$entityType = Mage::getModel(’eav/entity_type’)->loadByCode(’order’);
$entityType->setIncrementPadLength(7)->save();