public function Shipment::getWeight in Commerce Shipping 8.2
Gets the shipment weight.
Calculated by adding the weight of each item to the weight of the package type.
Return value
\Drupal\physical\Weight|null The shipment weight, or NULL if unknown.
Overrides ShipmentInterface::getWeight
File
- src/
Entity/ Shipment.php, line 300
Class
- Shipment
- Defines the shipment entity class.
Namespace
Drupal\commerce_shipping\EntityCode
public function getWeight() {
if (!$this
->get('weight')
->isEmpty()) {
return $this
->get('weight')
->first()
->toMeasurement();
}
}