code: protected function purge(ShipmentInterface $shipment)
      {
          foreach ($shipment->getItems() as $item) {
              if (0 == $item->getAvailable()) {
                  $shipment->removeItem($item);
              }
          }
      }
docs: Purges the shipment by removing items which are not available.
  
  @param ShipmentInterface $shipment