Magento 2 – Load Invoice by Invoice ID and Increment ID

invoicemagento2

I have an invoice id or an invoice increment id, is there a way to load an invoice using these?

Best Answer

Try this

private $invoice;

public function __construct(
    ....
    \Magento\Sales\Model\Order\Invoice $invoice
) {
    ....
    $this->invoice = $invoice;
}

....
....

// load invoice using entity id
$invoice = $this->invoice->load('1');
// OR
// load invoice using increment id
$invoice = $this->invoice->loadByIncrementId('000000001');

print_r($invoice->getData());
Related Topic