Here are the steps to create an invoice without updating total paid of order in Magento 2:

  1. Step 1: Use event sales_order_invoice_pay
  2. Step 2: Write the observer class

In Magento, the total paid by Orders will be increased after created an invoice. That means every time you create a new invoice, Magento records that you received money from customers. However in the case of using partial payment, customers can make the payment many times for an Order. You don’t want that each time they make a payment, you must create a new invoice. So how can we create the invoice without updating the total paid of Order? Just follow a few easy steps below. If want to programmatically create an invoice for an order then the solution is here you can learn here how to create an invoice for an order or a part of your order.

Create an invoice in Magento 2

Create an invoice in Magento 2

Step 1: Use event sales_order_invoice_pay

Declare observer in events.xml of your custom module: /app/code/[NameSpace]/[ModuleName]/etc/events.xml

Step 2: Write the observer class

/app/code/[NameSpace]/[ModuleName]/Observer/SalesOrderInvoicePay.php

 


Ready to foster your knowledge

with MAGENTO 2 BASIC GUIDE

magento 2 basic guide series


How to Send Order Email to A Custom Email Address
How to Get Stock Items List in Magento 2

Leave a Reply

Your email address will not be published. Required fields are marked *