Tutorialsplane

Magento 2 get Invoice from Order


Magento 2 get Invoice from Order– We can get invoice collection from order. Here in this tutorial, we are going to load order using order id then we will get invoice collection using order id.


Magento 2 get Invoice from Order Id | Invoice Collection Example

You can get Invoice Collection from order simply below-

Magento 2 get Invoice from Order Example:

$orderId = 9999;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('\Magento\Sales\Model\Order')                           ->load($orderId);
$invoiceCollection = $order->getInvoiceCollection();
foreach($invoiceCollection as $invoice){
 $invoiceIncrementID = $invoice->getIncrementId();// invoice increment id
 // same way get other details of invoice
}