You are here

function hook_commerce_shipping_collect_rates in Commerce Shipping 7.2

Allows modules or Rules to add shipping rates to an order object.

Added shipping rates meant to be used in building of the shipping service checkout pane.

Commerce Shipping includes a default Rules configuration that creates a rule per shipping method to go and find services defined by that method and use a rules component to determine whether or not the service should be rated for a particular order.

Modules implementing this hook directly should add rates to the order object by adding them to the $order->shipping_rates associative array. The key should be the machine-name of the shipping service and the value should be a shipping line item for the service whose unit price is set to the rate customers will be charged if they select that service.

Parameters

object $order: The order whose shipping rates should be collected.

See also

commerce_shipping_collect_rates()

File

./commerce_shipping.api.php, line 127
Contains API for commerce shipping module.

Code

function hook_commerce_shipping_collect_rates($order) {

  // No example.
}