hook_commerce_shipping_service_info() rate callback: What does the 'data' array do? hook_commerce_shipping_service_info() allows to specify a rate callback.

function snailmail_commerce_shipping_service_info() {
  [..]
  $shipping_services['snailmail']['callbacks']['rate'] = '_snailmail_rate';
  return $shipping_services;
}

function _snailmail_rate($shipping_service, $order) {
  return array(
    // Amount in EUR Cent
    'amount' =&gt; 250,
    'currency_code' =&gt; 'EUR',
    // What is this?
    'data' =&gt; array(),
  );
}


Question: What can I do with the 'data' array in the return value?
Prices in commerce have a data array to establish the original components and component modifiers that these might have. For example, discounts and taxes add components to alter a price after taxes.

I'd say you can use 'data' array as storage of context information like the line items do (they store the product display where the product has been added to the cart) and the price system stores the components there, so it's needed to add elements to it.

Check commerce_price_component_add and commerce_tax_rate_calculate for examples on where this is used.