You are here

function commerce_usps_get_order_shipping_address in Commerce USPS 7.2

Get the shipping address of the order.

2 calls to commerce_usps_get_order_shipping_address()
commerce_usps_rate in ./commerce_usps.module
Returns a base price array for a shipping service calculated for the order.
commerce_usps_validate_order in ./commerce_usps.module
Validate that the order can return a successful rate request.

File

./commerce_usps.module, line 267
Defines the USPS shipping method and services for Drupal Commerce.

Code

function commerce_usps_get_order_shipping_address($order) {
  $shipping_address = array();
  $order_wrapper = entity_metadata_wrapper('commerce_order', $order);

  // Determine the shipping profile reference field name for the order.
  $field_name = commerce_physical_order_shipping_field_name($order);

  // Prepare the shipping address for use in the request.
  if (!empty($order_wrapper->{$field_name}->commerce_customer_address)) {
    $shipping_address = $order_wrapper->{$field_name}->commerce_customer_address
      ->value();
  }
  return $shipping_address;
}