function commerce_shipping_commerce_price_component_type_info in Commerce Shipping 7.2
Same name and namespace in other branches
- 7 commerce_shipping.module \commerce_shipping_commerce_price_component_type_info()
Implements hook_commerce_price_component_type_info().
File
- ./
commerce_shipping.module, line 122 - Defines a system for calculating shipping costs associated with an order.
Code
function commerce_shipping_commerce_price_component_type_info() {
$components = array();
// Define a generic shipping price component type.
$components['shipping'] = array(
'title' => t('Shipping'),
'weight' => 20,
);
// Add a price component type for each shipping service that specifies it.
foreach (commerce_shipping_services() as $name => $shipping_service) {
if ($shipping_service['price_component'] && empty($components[$shipping_service['price_component']])) {
$components[$shipping_service['price_component']] = array(
'title' => $shipping_service['title'],
'display_title' => $shipping_service['display_title'],
'shipping_service' => $name,
'weight' => 20,
);
}
}
return $components;
}