Order Status History Complete no longer created, but was in M1 site

This is another answer that I hope will put this question to bed.

  • the previous answer shows how M2 has evolved and how it is possible now to see the order history. However, since you do seem to need to see also a notification when you are viewing the order (a bit of nostalgia feeling)

I have written a module that adds a notification when the shipment is created and reproduces what we had in M1

The module uses a plugin afterRegister plugin of the shipment model (see below)

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Sales\Model\Order\Shipment">
        <plugin name="order_shipped" type="Mbs\OrderNotifification\Plugin\ShipmentSavePlugin" sortOrder="999" />
    </type>
</config>


namespace Mbs\OrderNotifification\Plugin;


use Magento\Sales\Api\OrderRepositoryInterface;

class ShipmentSavePlugin
{
    /**
     * @var OrderRepositoryInterface
     */
    private $orderRepository;

    public function __construct(
        \Magento\Sales\Api\OrderRepositoryInterface $orderRepository
    ) {
        $this->orderRepository = $orderRepository;
    }

    public function afterRegister(\Magento\Sales\Model\Order\Shipment $shipment)
    {
        try {
            $order = $this->orderRepository->get($shipment->getOrderId());
            $order->addStatusHistoryComment('Order Complete', \Magento\Sales\Model\Order::STATE_COMPLETE);
        } catch (\Exception $e) {

        }
    }
}

see full code at order notification repo