1

I'm working on a case in which we need to put orders into a custom status after they have been invoiced (either manually in the backend or automatically by the payment method).

What I've found so far leaves me working with two events:

  • sales_order_place_after can be used to set my custom status on new orders which have been automatically invoiced (for orders using non-auto invoicing payment, such as money order, the business logic leaves the status as 'pending`).

  • sales_order_invoice_pay can be used to set the custom status on existing orders which have been invoiced manually via the backend.

The pitfall is that sales_order_invoice_pay fires in both cases. However in the automatic invoicing scenario the business logic later in the request lifecycle overrides my custom status and sets it to 'processing'.

Is there another event or hook that I could use to change the order status after it has been paid? Is there a way that my code within an event handler can determine if the order it is working with is a brand new order being automatically invoiced versus an existing order manually invoiced (I've considered inspecting the request or controller--but it seems fragile given that I'd like it to execute on the order lifecycle regardless of the origin).

Your Answer

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

Browse other questions tagged or ask your own question.