How To

How to Change Length of Order Increment ID in Magento 2

Hello Magento Friends,

Today I will be explaining How to Change Length of Order Increment ID in Magento 2.

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.

Let’s discover How to Change Length of Order Increment ID in Magento 2

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

<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

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.

Implementing the above steps will increase the length of order increment ID accordingly. 

Conclusion:

This way you can Change Length of Order Increment ID in Magento 2. The admin can also Show/Hide Order ID in Invoice, Shipment & Credit Memo PDF of Magento 2. In case of any trouble, mention in the comment part. I will be quick to solve it. Share the article with your fellow Magento colleagues and stay in touch with us!

Happy Coding!

Click to rate this post!
[Total: 7 Average: 4.4]
Dhiren Vasoya

Dhiren Vasoya is a Director and Co-founder at MageComp, Passionate ?️ Certified Magento Developer?‍?. He has more than 9 years of experience in Magento Development and completed 850+ projects to solve the most important E-commerce challenges. He is fond❤️ of coding and if he is not busy developing then you can find him at the cricket ground, hitting boundaries.?

View Comments

Recent Posts

Improving Error Handling and Transition Management in Remix with useRouteError and useViewTransitionState

In modern web development, seamless navigation and state management are crucial for delivering a smooth…

7 days ago

Magento Open Source 2.4.8-Beta Release Notes

Magento Open Source 2.4.8 beta version released on October  8, 2024. The latest release of…

1 week ago

How to Create Catalog Price Rule in Magento 2 Programmatically?

Hello Magento Friends, Creating catalog price rules programmatically in Magento 2 can be a valuable…

1 week ago

Top 10 Tips to Hire Shopify Developers

As the world of eCommerce continues to thrive, Shopify has become one of the most…

2 weeks ago

Managing Browser Events and Navigation in Shopify Remix: useBeforeUnload, useHref, and useLocation Hooks

Shopify Remix is an innovative framework that provides a streamlined experience for building fast, dynamic,…

2 weeks ago

Ultimate Guide to Hiring a Top Shopify Development Agency

Building a successful eCommerce store requires expertise, and for many businesses, Shopify has become the…

2 weeks ago