You are here

function commerce_shipping_collect_rates in Commerce Shipping 7.2

Collects available shipping rates for an order.

Collect shipping rates for an order, adding them to the order object via an unsaved shipping_rates property.

Parameters

object $order: The order for which rates will be collected.

2 calls to commerce_shipping_collect_rates()
commerce_shipping_line_item_add_form in ./commerce_shipping.module
Helper function.
commerce_shipping_pane_checkout_form in includes/commerce_shipping.checkout_pane.inc
Checkout pane callback: builds a shipping quote selection form.

File

./commerce_shipping.module, line 501
Defines a system for calculating shipping costs associated with an order.

Code

function commerce_shipping_collect_rates($order) {
  $order->shipping_rates = array();
  rules_invoke_all('commerce_shipping_collect_rates', $order);

  // Sort rates by the weight value of their line items. This value is derived
  // from the related shipping service's rate but may be overridden via
  // hook_commerce_shipping_method_collect_rates().
  uasort($order->shipping_rates, 'commerce_shipping_sort_rates');
}