/** * Returns array of items * * @param \Magento\Sales\Model\Order\Shipment $object * @return ShipmentItem[] */ protected function getItems(\Magento\Sales\Model\Order\Shipment $object) { $items = []; foreach ($object->getItemsCollection() as $item) { $items[] = $this->shipmentItemMapper->extractDto($item); } return $items; }
/** * Getter for billing address of order by format * * @param \Magento\Sales\Model\Order\Shipment $shipment * @return array */ public function getShipmentItems($shipment) { $res = array(); foreach ($shipment->getItemsCollection() as $item) { if (!$item->getOrderItem()->getParentItem()) { $res[] = $item; } } return $res; }