Normally, the default Magento 2 Order ID value is 9 digits long. However, we can completely customize the order ID length by adding code in the module. In this article, I will show you how to change the length of Order ID (Order Increment ID) in Magento 2.
Step by step
Step 1: Create a file named di.xml in the folder app\code\Vendor\Extension\etc.
Step 2: Add the following code below in di.xml file.
<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%'.04d%s</argument>
</arguments>
</type>
</config>
Note: You can replace the above number with any number you want
Step 3: Clear the cache in Magento 2.
Above is a guide to change order ID length in Magento 2
Leave a Reply