I want to inform customers with email all the details of their orders and I want to be able to show the difference. For example:

Those items shipped: ...
Those items cancelled: ...
Those items ...

credit memo, hold, invoice, ship, reorder, create returns... There so many situations. What should be the best way to achieve this?

Still I tried to use events for invoices (sales_order_invoice_save_after - sales_order_invoice_register):

public function execute(\Magento\Framework\Event\Observer $observer)
    $order = $observer->getEvent()->getOrder();
    $stateProcessing = $order::STATE_PROCESSING;

    $collection = $order->getItemsCollection();
    foreach ($collection as $item) {
        $this->logger->info('item = '.$item->getName());
        $this->logger->info('   qty_invoiced = '.$item->getData('qty_invoiced'));
        $this->logger->info('   qty_invoicedorig = '.$item->getOrigData('qty_invoiced'));

    return $this;

But quantities are the same, couldn't get the difference.

  • Did you want only invoiced? Apr 22, 2019 at 13:59
  • No, i want every actions. shipment, returns etc..
    – iskorum
    Apr 22, 2019 at 14:01
  • yes invoice and order item data are same if you try to create a partial credit memo for that then get it actually different in data. Apr 22, 2019 at 14:07
  • Hmm I will try this. But what about shipments? Which event should I use for shipments
    – iskorum
    Apr 22, 2019 at 14:13
  • I have posted an answer please check it. Apr 22, 2019 at 14:17

1 Answer 1


Below is the event list used to get the order collections data.

 - sales_order_save_after
 - sales_order_invoice_save_after
 - sales_order_shipment_save_after
 - sales_order_creditmemo_save_after

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.