1

Does in magento 2 exists event similar to event sales_order_invoice_save_after from magento 1?

Or, where should plugin "listen", to get similar functionality?

Thanks.

3

Yes, this event still exists. Just for your knowledge, I would like to share that it will always be fired whenever you made any change in order related data after invoice creation.

So it would be better to use "sales_order_invoice_pay" in case you want event to be fired only when first time invoice is created.

7
  • 1
    Thanks @Himmat Paliwal it works fine but one issue is there when use 'sales_order_invoice_save_after' i get the invoice increment id but when i use 'sales_order_invoice_pay' i am not get invoice id or increment id. can you please help how to get invoice id in event sales_order_invoice_pay. Apr 23 '20 at 4:54
  • It is being triggered from Magento\Sales\Model\Order\Invoice, line number 379, so you can check for the same what value you can get from there. Try by printing print_r($this->getEventObject()->getData()); Apr 23 '20 at 8:56
  • i have tried but get only order data not any invoice related data found Apr 23 '20 at 9:48
  • You can get invoice details if you have order id with you.. :) Check a bit on or create a separate issue in case. Apr 23 '20 at 14:33
  • okay thanks @Himmat Paliwal Apr 24 '20 at 4:16
0

Check this link for list of all events and observer of Magento-2. I hope this will help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.