Magento Asked by fernandus on October 2, 2021
How to get invoiceId from sales_order_invoice_pay event.
$invoice = $observer->getEvent()->getInvoice();
$invoice->getIncrementId();
Can’t get with this code But with sales_order_invoice_save_after event I can get the ID.
Can anyone help me out to get invoiceId from sales_order_invoice_pay
sales_order_invoice_pay
can provide order objects.From that order object, you can get invoices of an order, that can multiple invoices or single invoice.
$order = $observer->getEvent()->getOrder();
$invoiceList = $order->getInvoiceCollection();
if (count($invoiceList->getItems()) > 1) {
foreach ($invoiceList as $invoice){
$invoice->getIncrementId();
}
}
Correct answer by Amit Bera on October 2, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP