Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
OrderRegistrar.php
Go to the documentation of this file.
1 <?php
7 
10 
11 class OrderRegistrar implements \Magento\Sales\Model\Order\Shipment\OrderRegistrarInterface
12 {
18  public function register(OrderInterface $order, ShipmentInterface $shipment)
19  {
20  $totalQty = 0;
22  foreach ($shipment->getItems() as $item) {
23  if ($item->getQty() > 0) {
24  $item->register();
25 
26  if (!$item->getOrderItem()->isDummy(true)) {
27  $totalQty += $item->getQty();
28  }
29  }
30  }
31  $shipment->setTotalQty($totalQty);
32 
33  return $order;
34  }
35 }
$order
Definition: order.php:55
foreach($order->getItems() as $orderItem) $shipment