I want to catch the moment of creating order - both in frontend by
client and in administration panel by user. I’ve got a plugin for it:
class Plugin
{
public function afterSave(
$subject,
$order, $additional = []
)
{
exit('aftersave');
}
public function afterPlace(
$subject,
$order, $additional = []
)
{
$order_id = $order->getEntityId(); // this is null
exit('afterPlace');
}
}
The afterSave method is not executed when creating order. The second -
afterPlace method is executed, but I cat’t get the entity id.
How to do it? What method should I listen to or how to get the order id?