You are here

function commerce_avatax_get_customer_profile_field in Drupal Commerce Connector for AvaTax 7.5

Returns the configured customer profile field to use.

3 calls to commerce_avatax_get_customer_profile_field()
commerce_avatax_calculate_tax in ./commerce_avatax.module
Performs Tax calculation for a given order.
commerce_avatax_checkout_validate in ./commerce_avatax.module
Checkout form validation callback.
_commerce_avatax_transaction_get_ship_to in includes/commerce_avatax.calc.inc
Returns the shipTo address for a transaction.

File

./commerce_avatax.module, line 1137
AvaTax service integration from Avalara, Inc.

Code

function commerce_avatax_get_customer_profile_field() {
  $customer_profile_to_use = variable_get(COMMERCE_AVATAX_VAR_PREFIX . 'tax_address', 'shipping');
  $profile_types = commerce_customer_profile_types();

  // Fallback to the first customer profile type available.
  if (!isset($profile_types[$customer_profile_to_use])) {
    $customer_profile_to_use = key($profile_types);
  }
  $pane_id = 'customer_profile_' . $customer_profile_to_use;
  if ($field_name = variable_get('commerce_' . $pane_id . '_field', '')) {
    return $field_name;
  }
  return FALSE;
}