Shipment/EventListener/AbstractShipmentItemListener.php
public function onDelete(ResourceEventInterface $event)
    {
        $item = $this->getShipmentItemFromEvent($event);

        // Get shipment from change set if null
        if (null === $shipment = $item->getShipment()) {
            $shipment = $this->persistenceHelper->getChangeSet($item, 'shipment')[0];
        }

        // If shipment state has changed to stockable
        $stateCs = $this->persistenceHelper->getChangeSet($shipment, 'state');
        if (!empty($stateCs) && Model\ShipmentStates::hasChangedToStockable($stateCs)) {
            // Abort (item was not assigned)
            return;
        }

        // If shipment is (or was) in a stockable state
        if (
            Model\ShipmentStates::isStockableState($shipment->getState()) ||
            (!empty($stateCs) && Model\ShipmentStates::hasChangedFromStockable($stateCs))
        ) {
            // Detach shipment item to stock units
            $this->stockUnitAssigner->detachShipmentItem($item);
        }

        $this->scheduleShipmentContentChangeEvent($shipment);
    }
public function onDelete(ResourceEventInterface $event)
    {
        $item = $this->getShipmentItemFromEvent($event);

        // Get shipment from change set if null
        if (null === $shipment = $item->getShipment()) {
            $shipment = $this->persistenceHelper->getChangeSet($item, 'shipment')[0];
        }

        // If shipment state has changed to stockable
        $stateCs = $this->persistenceHelper->getChangeSet($shipment, 'state');
        if (!empty($stateCs) && Model\ShipmentStates::hasChangedToStockable($stateCs)) {
            // Abort (item was not assigned)
            return;
        }

        // If shipment is (or was) in a stockable state
        if (
            Model\ShipmentStates::isStockableState($shipment->getState()) ||
            (!empty($stateCs) && Model\ShipmentStates::hasChangedFromStockable($stateCs))
        ) {
            // Detach shipment item to stock units
            $this->stockUnitAssigner->detachShipmentItem($item);
        }

        $this->scheduleShipmentContentChangeEvent($shipment);
    }
Delete event handler.

@param ResourceEventInterface $event