You are here

function commerce_fedex_commerce_shipping_service_info in Commerce FedEx 7

Implements hook_commerce_shipping_service_info().

File

./commerce_fedex.module, line 45
Defines the FedEx shipping method and services for Drupal Commerce.

Code

function commerce_fedex_commerce_shipping_service_info() {
  $shipping_services = array();
  $available_services = commerce_fedex_shipping_service_types();
  $selected_services = variable_get('commerce_fedex_services', array());
  foreach ($selected_services as $id => $val) {
    if (!empty($val)) {
      $service = $available_services[$id];
      $shipping_services[drupal_strtolower($id)] = array(
        'title' => $service,
        'description' => $service,
        'display_title' => $service,
        'shipping_method' => 'fedex',
        'price_component' => 'shipping',
        'callbacks' => array(
          'rate' => 'commerce_fedex_service_rate_order',
        ),
      );
    }
  }
  return $shipping_services;
}