function commerce_shipping_pane_review in Commerce Shipping 7.2
Checkout pane callback.
Show the selected shipping service on the review pane.
File
- includes/
commerce_shipping.checkout_pane.inc, line 409 - Callback functions for the shipping module's checkout panes.
Code
function commerce_shipping_pane_review($form, $form_state, $checkout_pane, $order) {
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
// Loop over all the line items on the order.
foreach ($order_wrapper->commerce_line_items as $delta => $line_item_wrapper) {
// If the current line item is a shipping line item...
if ($line_item_wrapper->type
->value() == 'shipping') {
// Return its label and formatted total price.
$total_price = $line_item_wrapper->commerce_total
->value();
$rate = commerce_currency_format($total_price['amount'], $total_price['currency_code'], $line_item_wrapper
->value());
return t('!service: !rate', array(
'!service' => $line_item_wrapper->line_item_label
->value(),
'!rate' => $rate,
));
}
}
}