I want to inform customers with email all the details of their orders and iI want to be able to show the difference. For example:
Those items shipped: ...
Those items canceledcancelled: ...
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.