function _commerce_avatax_transaction_get_ship_to in Drupal Commerce Connector for AvaTax 7.5
Returns the shipTo address for a transaction.
1 call to _commerce_avatax_transaction_get_ship_to()
- commerce_avatax_create_transaction in includes/
commerce_avatax.calc.inc - Prepares the transaction request array to be sent to AvaTax.
File
- includes/
commerce_avatax.calc.inc, line 262 - AvaTax calculation/requests functions.
Code
function _commerce_avatax_transaction_get_ship_to($order_wrapper) {
$ship_to = array();
$customer_profile_field = commerce_avatax_get_customer_profile_field();
// Retrieve the address from the configured customer profile type.
if (!empty($customer_profile_field) && isset($order_wrapper->{$customer_profile_field})) {
if (isset($order_wrapper->{$customer_profile_field}->commerce_customer_address)) {
$address = $order_wrapper->{$customer_profile_field}->commerce_customer_address
->value();
// Prepare the Ships from address.
$ship_to = array(
'line1' => $address['thoroughfare'],
'line2' => $address['premise'],
'city' => $address['locality'],
'region' => $address['administrative_area'],
'country' => $address['country'],
'postalCode' => $address['postal_code'],
);
}
}
return $ship_to;
}