0

I need to call observer which must be called when a shipment is created and after it is saved. I tried using the event

sales_order_shipment_save_after

but it is called before shipment is saved and before there is an entry in the database.

10
  • which magento version are you on? there are differnces between 2.0, 2.1, 2.2 and 2.3 Dec 4, 2018 at 12:24
  • version is 2.2.5
    – GenZ Dev
    Dec 4, 2018 at 12:28
  • 1
    then sales_order_shipment_save_commit_after probably does what you want. kudos to magento.stackexchange.com/a/120029/34273 Dec 4, 2018 at 12:49
  • 1
    You can use a plugin for the corresponding resource model (the afterSave method) Dec 4, 2018 at 13:52
  • 1
    sales_order_shipment_save_commit_after worked. @PhilippSander post it as an answer so I'll accept it.
    – GenZ Dev
    Dec 5, 2018 at 10:26

1 Answer 1

5

sales_order_shipment_save_commit_after does what you want.

The *_save_commit_after event is triggered after the transaction has been committed, i.e. when the changes were written to the database.

kudos to Fabian Schmengler

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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