How to Set Invoice Numbers to Depend on Order Numbers in Magento 2

The Most Popular Extension Builder for Magento 2

With a big catalog of 224+ extensions for your online store

Magento 2 Custom Order Number made by Mageplaza is well-known as an indispensable tool which supports store owners to customize the default string of Magento 2 to the sophisticated one to manage and protect business data. The most useful feature of this module is generating the same invoice number based on the purchase number. This function helps shop admins save time to control their work.

Table of Contents

Why setting invoice numbers to depend on order numbers is useful?

setting invoice numbers to depend on order numbers

Invoice number for each order is unique in your company’s accounting system, which helps you identify the shipments and customers. This is the reason why creating an associated formula between orders and related billing documents such as invoices, shipment, credit memo is necessary. When a customer places any purchase at your store, the system will make the format of order ID based on your intention thanks Mageplaza Custom Order Number.

An issued invoice will have the string linked with the series’ structure. The format of invoice ID can be generated by replacing the prefix with another letters and keeping the rest of the pattern unchanged. For example, the order number is ORD-01-280519-001, while it’s invoice is INV-01-280519-001. The structure set by store owners not only helps protect internal data from competitors but also impress visitors by a professional-looking number system from order, invoice, shipment, and credit memo.

How to configure same invoice numbers depending on order numbers?

Before setting up the invoice string matching with its order, let’s take a look at the configuration at the backend. Please go to the Magento Admin, choose Store > Settings > Configuration > Custom Order Number

configure same invoice numbers depending on order numbers

For General Configuration, go to Store > Settings > Configuration > Custom Order Number > General


In the Enable box, you can choose Yes to allow this module.

Firstly, store owners need to adjust the structure of orders before creating the same invoice series based on its format. From the Admin Panel, go to Store > Settings > Configuration > Custom Order Number, choose Order Number section.

Order Number

At Order Number section, choose “Yes” at Enable box to activate this function. Then, you can set up the number order strings as your intention by using syntax. After finishing the based steps to create the formula of the order string, generating the invoice number’s structure will be more simple.

Invoice Number

At Enable box, you choose option “Same as Order Number” to use the configuration the same as the configuration of Order Number At Replace row, you can type the prefix of order series which would be changed. If leaving this blank, after saving, the Invoice ID will display the same as the configuration of Magento 2.

At To field, you will fill the replacement value. If leaving this field blank, the value in front of the Replace field will be used. This value is the same as you added in the previous row. For example, the order number, which is ORD-01-280519-001 will be replaced to INV-01-280519-001 for its detailed invoice. The combination between Custom Order Number extension and PDF Invoice allows displaying in the proper format in billing documents which can be sent to customers or print in different sizes of paper.

Final words

To sum up, Custom Order Number is a useful tool for every store using the Magento 2 platform for its e-commerce. For the medium and big online shop, it will help store owners to track their orders smartly. With the string of the invoice, they know it applies to which order ID and all information related to the customer. For the newly established stores, it’s not only a way to impress customers due to the professional structure for invoice and order but also hide the sophisticated information to their rivals.


Website Support
& Maintenance Services

Make sure your store is not only in good shape but also thriving with a professional team yet at an affordable price.

Get Started
mageplaza services

Stay in the know

Get special offers on the latest news from Mageplaza.

Earn $10 in reward now!

Earn $10 in reward now!

go up