The default value of the Increment ID is 9 digits in Magento 2. Although the Magento 2 admin can customize the size of the order increment ID in the custom module. The order increment ID can be increased or decreased according to the requirement. The customized order increment ID will also be changed for shipment, invoice, and credit memos.
Steps to Change Length of Order Increment ID in Magento 2:
Step 1: Go to the below path
app\code\Vendor\Extension\etc\di.xml
And add the code as mentioned below
1
2
3
4
5
6
7
|
<config xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=“urn:magento:framework:ObjectManager/etc/config.xsd”>
<type name=“Magento\Framework\DB\Sequence\SequenceInterface”>
<arguments>
<argument name=“pattern” xsi:type=“string”>%s%‘.07d%s</argument>
</arguments>
</type>
</config>
|
Step 2: Run the below command after adding the above code
1
2
|
php bin/magento c:c
php bin/magento c:f
|
Here the length of the Increment Id will be 7 digits. However, you can place any digit as per your requirement for a customized increment number. The length of increment changed here will be the same for the invoice, shipment, and credit memo.