We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

    If you want to remove all leading zero’s from order, invoice and shipment number in Magento 2 then follow below steps

    Step 1: Create Registration

    Create registration.php file in the app/code/Magemonkeys/Ordersequence folder with the following code.

    <?php
    MagentoFrameworkComponentComponentRegistrar::register(
        MagentoFrameworkComponentComponentRegistrar::MODULE,
        'Magemonkeys_Ordersequence',
        __DIR__
    );

    Step 2: Create a module

    Create a module.xml file in the app/code/Magemonkeys/Ordersequence/etc folder with the following code.

    <?xml version="1.0"?>
     
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
        <module name="Magemonkeys_Ordersequence" setup_version="1.0.0"></module>
    </config>

    Step 3: Create a di

    Create a di.xml file in the app/code/Magemonkeys/Ordersequence/etc folder with the following code.

    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
        <type name="MagentoFrameworkDBSequenceSequenceInterface">
            <arguments>
                <argument name="pattern" xsi:type="string">%s%'.06d%s</argument>
            </arguments>
        </type>
    </config>

    Step 4 : After place above code, please run below mentioned commands

    - php bin/magento setup:upgrade
    
    - php bin/magento setup:static-content:deploy
    
    - php bin/magento cache:clean

    That’s it.

    Now refresh your admin order page and see that leading zero’s should be removed.

    Fill the below form if you need any Magento relate help/advise/consulting.

    With Only Agency that provides a 24/7 emergency support.

      Get a Free Quote