function commerce_shipping_line_item_title in Commerce Shipping 7
Same name and namespace in other branches
- 7.2 commerce_shipping.module \commerce_shipping_line_item_title()
Returns an appropriate title for this line item.
File
- ./
commerce_shipping.module, line 170 - Defines the shipping system and checkout integration.
Code
function commerce_shipping_line_item_title($line_item) {
$line_item_wrapper = entity_metadata_wrapper('commerce_line_item', $line_item);
// Try to get the title from the plugin.
if ($line_item_wrapper->commerce_shipping_method
->value()) {
$shipping_method = commerce_shipping_plugin_get_plugin('quotes', $line_item_wrapper->commerce_shipping_method
->value());
if (!empty($shipping_method)) {
return $shipping_method['display_title'];
}
}
// Fallback to the line item label.
return $line_item->line_item_label;
}