0

I am using Magento-2.1.7 and I want to change order, invoice and shipment number from 10000001 to 20000000.

How can I do this?

1

Please perform following.

  1. Open your PHP Admin database
  2. Find & click on the table called: sequence_order_1 (it is located in database itself not in the information_schema )
  3. Click on "Operations" tab & under "AUTO_INCREMENT" edit to desired order number.

You can do same for shipment and invoice tables sequence_invoice_1 and sequence_shipment_1

EDIT To change digits length.

Change The Sequence To change the order number padding edit Sequence.php (I believe there is a better way via a di.xml)

vendor/magento/module-sales-sequence/Model/Sequence.php

Edit this line

const DEFAULT_PATTERN  = "%s%'.09d%s";

Change the "9" to the desired padding

Example

const DEFAULT_PATTERN  = "%s%'.08d%s";
  • How could I change the number of digits as Magento uses 9 while I want to use 8 digits? – Rishabh Rk Rai Mar 22 '18 at 8:23
  • @RishabhRkRai I edited answer. Please check. – Kishan Patadia Mar 22 '18 at 8:25
  • Instead of 9, you can use 8. – Kishan Patadia Mar 22 '18 at 8:26
  • I make changes in the code, but still it shows 9 digits. – Rishabh Rk Rai Mar 22 '18 at 8:31
  • Please try clearing cache and removing var folder of your magento. – Kishan Patadia Mar 22 '18 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.