protected function FedEx::getPackageVolume in Commerce FedEx 8
Gets the volume of the provided package type.
Parameters
\Drupal\commerce_shipping\Plugin\Commerce\PackageType\PackageTypeInterface $package_type: The package type.
Return value
float The volume.
File
- src/
Plugin/ Commerce/ ShippingMethod/ FedEx.php, line 650
Class
- FedEx
- Provides the FedEx shipping method.
Namespace
Drupal\commerce_fedex\Plugin\Commerce\ShippingMethodCode
protected function getPackageVolume(PackageTypeInterface $package_type) {
$unit = $package_type
->getHeight()
->getUnit();
$number = $package_type
->getHeight()
->multiply($package_type
->getWidth()
->convert($unit)
->getNumber())
->multiply($package_type
->getLength()
->convert($unit)
->getNumber())
->getNumber();
return (double) $number;
}