You are here

protected function UPSShipment::getValidWeightUnit in Commerce UPS 8.3

Get valid weight measurement unit for a current store address.

Return value

string Valid measurement unit.

1 call to UPSShipment::getValidWeightUnit()
UPSShipment::setWeight in src/UPSShipment.php
Define the package weight.

File

src/UPSShipment.php, line 233

Class

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

Namespace

Drupal\commerce_ups

Code

protected function getValidWeightUnit() {

  /** @var \CommerceGuys\Addressing\Address $address */
  $address = $this->shipment
    ->getOrder()
    ->getStore()
    ->getAddress();
  return $address
    ->getCountryCode() == 'US' ? WeightUnit::POUND : WeightUnit::KILOGRAM;
}