You are here

protected function UPSShipment::getPackageType in Commerce UPS 8.3

Determine the package type for the shipment.

Return value

\Drupal\commerce_shipping\Plugin\Commerce\PackageType\PackageTypeInterface The package type.

File

src/UPSShipment.php, line 204

Class

UPSShipment
Class to create and return a UPS API shipment object.

Namespace

Drupal\commerce_ups

Code

protected function getPackageType() {

  // If the package is set on the shipment, use that.
  if (!empty($this->shipment
    ->getPackageType())) {
    return $this->shipment
      ->getPackageType();
  }

  // Or use the default package type for the shipping method.
  return $this->shippingMethod
    ->getDefaultPackageType();
}