public function UPSShipment::setPackagingType in Commerce UPS 8.3
Sets the package type for a UPS package.
Parameters
\Ups\Entity\Package $ups_package: A Ups API package entity.
1 call to UPSShipment::setPackagingType()
- UPSShipment::setPackage in src/
UPSShipment.php - Sets the package for a given shipment.
File
- src/
UPSShipment.php, line 190
Class
- UPSShipment
- Class to create and return a UPS API shipment object.
Namespace
Drupal\commerce_upsCode
public function setPackagingType(UPSPackage $ups_package) {
$remote_id = $this
->getPackageType()
->getRemoteId();
$attributes = new \stdClass();
$attributes->Code = !empty($remote_id) && $remote_id != 'custom' ? $remote_id : PackagingType::PT_UNKNOWN;
$ups_package
->setPackagingType(new PackagingType($attributes));
}