Magento 2 Tutorials

How to Customize Invoice Numbers in Magento 2?

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)
How to Customize Invoice Numbers in Magento 2 Stores

It’s great to be a business owner, but only if you get paid in a timely manner. To get paid on time, your business will need a properly-organized invoice management system that monitors and reviews your finances. Numbering and differentiating your invoices play a crucial part in this system. 

Hence, businesses need to assign an invoice number to each invoice they issue to specify sales and purchases from one another. These codes are all different and created via a consistent numbering system.

However, invoice numbers are created systematically and legally in some regions. In some countries, companies are required to comply with strict regulations. Consequently, store owners have to customize their invoice numbers to meet any local invoice number requirements. 

The following article will bring you a detailed guide on how to customize invoice numbers in Magento 2 stores.

Let’s get it started now! 

What is an Invoice Number?

Incoice Number

Invoices are bills that contain the products and services a shopper has bought, along with the corresponding amount they need to pay. An accurate-documented invoice will include some elements below:

  • Invoice ID or invoice number 
  • Customer contact data
  • Business contact data
  • Description of the product/ service
  • Date of delivery
  • The payment due date
  • The unit price of the product/ service
  • The total amount
  • Other payment terms 

The invoice number (also called the invoice ID or reference number) is a unique and sequential number attached to every invoice. This code is to specify and monitor transactions and prevent any duplicate payments as well. It can consist of numbers, or both numbers and letters. 

Why is an Invoice Number Significant? 

If generating invoice numbers properly, your business can: 

  • Track payment with ease: When a shopper has a problem related to an a-few-months-old invoice, you can easily find this invoice if your business runs a logical numbering system. Or else, tracking it down can be time-wasting and bothering for both the seller and the purchaser. 
  • Stop duplicate payments: Billing your customers twice or inaccurately can lead to significant losses for your business, in time, money, and reputation. 
  • Offer professional and legitimate service: Depending on your region, your business might not be required to generate invoice numbers. However, most customers ask for reference numbers on their invoices as it ensures transparency and professionalism.
  • Properly document income for taxes: With the aid of invoice numbers, the tax office can revise invoices against the sales and spending of your company. 

How to Customize Invoice Numbers in Magento 2 Stores? 

The first thing to customize invoice numbers is to install an extension to Magento 2 store. Here we suggest installing the Customer Order Number extension for Magento 2 by Mageplaza. In addition to customizing invoice numbers, the module also helps you make changes to order numbers, order number patterns, order increment ID, etc. 

Now follow the instruction below to adjust invoice numbers in your Magento 2 store. 

Log in to the Magento Admin, navigate to Store > Settings > Configuration > Mageplaza Extensions > Customer Order Number > Invoice Number 

Order Number
  • Enable:
    • Select Yes to enable changing the ID of invoices
    • Select Same as Order Number to use the configuration of Order Number 
Invoice Number
  • Replace:
      • Fill in the characters you want to edit if you select the same configuration as that of Order Number
      • If you leave the field blank, the Invoice ID will appear the same as the configuration of Magento.
  • To:
      • If this field is left blank, the value in the Replace field will be utilized. This value is similar to the value in the Order Number section.
      • This value will replace the value in the Replace field.
  • Pattern:
      • Insert the format for invoice ID. For example, INV-[store_id]-[yy]-[mm]-[dd]-[2N]-[2counter]
      • Only accept some variables, including [store_id], [yy], [mm], [dd], [2N], [2counter], [4AN], [4A], [4N], [y], [yyy], [M], [D], [m], , [store_code]. 
      • If you enter the wrong format of supported variables, the invoice ID will be shown under the text. 
  • Counter Start From: 
      • Insert the counter when using the [counter] variable. If the number of digits in this field is less than that of the [counter] variable, 0 will be automatically added in front of the ID. For instance: You enter 14, the counter variable will be [3counter]. The ID will be 014. 
      • The ID of the next invoice will start with the number inserted and incrementally increase according to the Counter by Step field.
      • For instance, as you use the [2counter], if you insert 05, the invoice ID will begin from 05. 
      • If you want to edit the Counter Start From field, after inserting a new value and saving, you need to click on the Reset Now button so that the invoice ID can have a new Counter Start From value. 
  • Counter by Step:
      • Fill in the distance number of invoice ID of the next invoices
      • For instance, if you enter 3, the ID of the next invoices will be separated by three units.
      • If you leave this field blank, the default will be 1 unit.
  • Counter by Store:
      • If you select Yes, the invoice ID of various stores will change separately according to each store’s configuration. For instance, Store A has an invoice ID as 30. Store B has no invoice. If shoppers buy a product at Store B, the invoice ID will be 01. 
      • If you select No, the invoice ID of multiple stores will be merged and get high according to the configuration of the Main Website. For example, Store A has 30 invoices, the invoice ID is 30, and Store B has no invoice. When shoppers buy products at Store B, the invoice will be 31. 
  • Reset Counter:
Reset Counter
  • Reset Counter = Daily: The counter will be reset to the Counter Start From value at 00:00 every day.
  • Reset Counter = Weekly: The counter will be reset to the Counter Start From value at 00:00 every the first day of the week.
  • Reset Counter = Monthly: The counter will be reset to the Counter Start From value at 00:00 every the first day of the month.
  • Reset Counter = Daily: The counter will NOT be reset to the Counter Start From value.
  • Reset Now Button: The counter will be reset to the Counter Star From value that is currently used. For instance, the Counter Start field value is 1000, the Counter Step is 10. If the Reset Now button is clicked, the ID of the next invoice will begin from the value which is the sum of the Counter Start From and Counter Step values. 


That’s all about the instruction to customize invoice numbers in Magento 2. And the Mageplaza Custom Order Number extension gives you great flexibility in setting the invoice number structure so that your online store can satisfy any local invoice number demands.

You may also like
Magento 2.4 Features
Enhance Website’s Performance with Fascinating Features of Magento 2.4
How to Show Recently Viewed Products Programmatically in Magento 2
How to Show Recently Viewed Products Programmatically in Magento 2?

Leave Your Comment

Your Comment*

Your Name*