How to create invoice programmatically in magento 2?

We just need to pass order id in generateInvoice($orderId) function from template. Below code snippet is used for generating Invoice in Magento 2, After generating an invoice automatically send the invoice mail to a customer who has placed the order.

Call function from a template,

 

One Reply to “How to create invoice programmatically in magento 2?”

Leave a Reply

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