I am using an observer to handle some logic when a new order is created or updated. The observer listen to sales_order_save_commit_after
event, but I noticed that when the user is not logged in this event does not fire. What is the reason that it does not trigger in this case? Can it be substituted with some other event?
P.s. I checked some other events, like sales_order_save_after
but the items are still not saved when it triggers and checkout_onepage_controller_success_action
does not work in case of creating the order from admin.
Best Answer
In the
Temando_Shipping
module there is the methodTemando\Shipping\Plugin\Sales\OrderRepositoryPlugin::afterSave
.In the comment of this method there is this
I don't have a response to "why?" I'm just stating that it's by design.
As a bonus
checkout_onepage_controller_success_action
is not dispatched in admin because that's event is not triggered at all in the backend.Maybe you can use a plugin similar to what the Temando module uses.
An
afterSave
plugin on the Order repository class.