You are here

public static function FedEx::isDomestic in Commerce FedEx 8

Returns a bool indicating if the shipment is domestic.

Parameters

\Drupal\commerce_shipping\Entity\ShipmentInterface $shipment: The shipment.

Return value

bool TRUE if the shipment is domestic, FALSE otherwise.

1 call to FedEx::isDomestic()
FedEx::shippingType in src/Plugin/Commerce/ShippingMethod/FedEx.php
Gets the shipping type of the shipment.

File

src/Plugin/Commerce/ShippingMethod/FedEx.php, line 1137

Class

FedEx
Provides the FedEx shipping method.

Namespace

Drupal\commerce_fedex\Plugin\Commerce\ShippingMethod

Code

public static function isDomestic(ShipmentInterface $shipment) {

  /* @var  AddressItem $shipping_address */
  $shipping_address = $shipment
    ->getShippingProfile()
    ->get('address')
    ->first();
  $domestic = $shipping_address instanceof AddressItem ? $shipment
    ->getOrder()
    ->getStore()
    ->getAddress()
    ->getCountryCode() == $shipping_address
    ->getCountryCode() : FALSE;
  return $domestic;
}