I need to execute some custom code after invoice is created

I have some code working fine, when invoices are created in backoffice (I am observing sales_order_save_before event & checking for a state change to detect if the invoice has been created), but this does not work when 3rd party payment methods create the invoice during frontend checkout process

I am not sure if I can achieve this with observer / event approach, or maybe a plugin should be the right method. Any tips?

  • 2
    Have you tried using this event on the front end? this shoul give you the result your looking for no matter the gateway sales_order_invoice_save_after – Dava Gordon Sep 12 '17 at 21:50

I finally solved this using sales_order_invoice_pay event, which is fired both in adminhtml & frontend scopes

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.