Custom Order Numbers¶
Introduction¶
The Custom Order Numbers extension lets you to expand the native numbering scheme of Magento 2 through order length editing, custom prefixes, increment prefixes, and starting numbers. With this under control, you’ll protect valuable business data from being publicly available, indicate the kind of documentation (order, invoice, shipment or credit memo), make order number digits more customer-friendly, and so much more.
Requirements and Installation¶
Custom Order Number supports both Community (Open Source) and Enterprise (Commerce) edition of Magento starting from version 2.2. The current version of the Magento installed on your website can be found in the lower right corner of any backend page.

Custom Order Number has 3 separate ways of installation:
1) Copy the code (ready-to-paste package);
2) Use MageWorx Repository.
3) Use local Composer;
Extension Configuration.¶
The Custom Order Number extension allows change the numbers of your orders, invoices, credit memos and shipments using advanced and flexible templates. The extension can be configured in STORES ⟶ Configuration ⟶ MageWorx tab ⟶ Custom Order Number.
Please note that the extension doesn't change the numbers of the existing orders, only new orders will be affected.
Order Template¶
In order to customize the number template for the orders, please go to the Custom Order Number section.

- Enable - this setting enables the order template for the new orders.
- Number Format - this field sets the order number template for the orders. You can add a custom text here and use the predefined variables:
--- {d} - it will display the date as one number. Example: if the date is June 5, this variable will display 5.
--- {dd} - it will display the date as 05 (from the previous example).
--- {m} - it will display the month as one number. Example: if the month is June, this variable will display 6.
--- {mm} - it will display the date as 06 (from the previous example).
--- {yy} - it will display the year. Example: if the year is 2019, this variable will display 19.
--- {yyyy} - it will display the date as 2019 (from the previous example).
--- {counter} - this variable displays the current value of the counter, which is dynamically changes with each new order.
--- {storeId} - this variable displays the ID of the store view, where the order was placed.
--- {rndNumbers} - this variable generates a random number. Example: if you need to generate two digits number, you can use {rndNumbers2}, if you need to generate five digits number, you can use {rndNumbers5}.
--- {rndLetters} - this variable generates random letters. Example: if you need to generate two letters, you can use {rndLetters2}, if you need to generate five letters, you can use {rndLetters5}. - Start Counter From - this setting defines a starting value for the counter variable. If this setting is set to 5, the counter will start from 5. The value in this field cannot be reduced.
- Counter Increments Step - this setting defines a step for the counter variable. If this setting is set to 2 and the counter starts from 5, then the next counter value will be 7 (5 + 2).
- Number Counter Padding - this setting defines the total number of digits of the {counter} variable. If you set this field to 6 and the counter is 20, the counter number displayed will be 000020.
The generated number must be shorter than 32 characters. If it is longer, the settings are not saved and an error message is shown. The same applies to the invoice, shipment and credit memo numbers.
Invoice Template¶
These settings are in the Custom Invoice Number section.
- Enable - this setting enables the invoice template for the new invoices.
- Same as Order Number - this setting defines whether the order number should be used for the invoices. If yes, you can specify the Invoice prefix and the Order part that should be replaced with it. If this setting is set to No, you can specify the separate template for the invoices with the Number Format, Start Counter From, Counter Increments Step and Number Counter Padding settings. They work the same way as for the orders and have a separate counter.
- Prefix - this setting defines the invoice prefix that will replace the order part, specified in the next setting.
- Part of the order number to replace with the prefix - this setting defines the order part, which should be replaced with the invoice prefix. Example: If you have the order number as 'ORD', you can replace the 'ORD' part with the prefix instead of adding it in the beginning.
Shipment Template¶
These settings are in the Custom Shipment Number section.
- Enable - this setting enables the shipment template for the new shipments.
- Same as Order Number - this setting defines whether the order number should be used for the shipments. If yes, you can specify the Shipment prefix and the Order part that should be replaced with it. If this setting is set to No, you can specify the separate template for the shipments with the Number Format, Start Counter From, Counter Increments Step and Number Counter Padding settings. They work the same way as for the orders and have a separate counter.
- Prefix - this setting defines the shipment prefix that will replace the order part, specified in the next setting.
- Part of the order number to replace with the prefix - this setting defines the order part, which should be replaced with the shipments prefix. Example: If you have the order number as 'ORD', you can replace the 'ORD' part with the prefix instead of adding it in the beginning.
Credit Memo Template¶
These settings are in the Custom CreditMemo Number section.
- Enable - this setting enables the credit memo template for the credit memos.
- Same as Order Number - this setting defines whether the order number should be used for the credit memos. If yes, you can specify the credit memo prefix and the Order part that should be replaced with it. If this setting is set to No, you can specify the separate template for the credit memos with the Number Format, Start Counter From, Counter Increments Step and Number Counter Padding settings. They work the same way as for the orders and have a separate counter.
- Prefix - this setting defines the credit memo prefix that will replace the order part, specified in the next setting.
- Part of the order number to replace with the prefix - this setting defines the order part, which should be replaced with the credit memo prefix. Example: If you have the order number as 'ORD', you can replace the 'ORD' part with the prefix instead of adding it in the beginning.
Got Questions?¶
Need help with the extensions? Feel free submit a ticket from https://www.mageworx.com/support/
Mageworx offers outstanding services developing custom-tailored solutions for Magento platform to attain your eCommerce objectives. Our professional impassioned team provides profound and custom oriented development of your project in a short timeframe.