You are here

protected function UPSShipment::getValidDimensionsUnit in Commerce UPS 8.3

Get valid dimensions measurement unit for a current store address.

Return value

string Valid measurement unit.

1 call to UPSShipment::getValidDimensionsUnit()
UPSShipment::setDimensions in src/UPSShipment.php
Package dimension setter.

File

src/UPSShipment.php, line 220

Class

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

Namespace

Drupal\commerce_ups

Code

protected function getValidDimensionsUnit() {

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