public function Shipment::getTotalQuantity in Commerce Shipping 8.2
Gets the total quantity.
Represents the sum of the quantities of all shipment items.
Return value
string The total quantity.
Overrides ShipmentInterface::getTotalQuantity
File
- src/
Entity/ Shipment.php, line 252
Class
- Shipment
- Defines the shipment entity class.
Namespace
Drupal\commerce_shipping\EntityCode
public function getTotalQuantity() {
$total_quantity = '0';
foreach ($this
->getItems() as $item) {
$total_quantity = Calculator::add($total_quantity, $item
->getQuantity());
}
return $total_quantity;
}