You are here

function commerce_shipping_service_callback in Commerce Shipping 7.2

Returns the specified callback for the given shipping service if one exists.

Parameters

array $shipping_service: The shipping service info array.

string $callback: The callback function to return, one of:

  • rate
  • details_form
  • details_form_validate
  • details_form_submit.

Return value

string|bool A string containing the name of the callback function or FALSE if it could not be found.

4 calls to commerce_shipping_service_callback()
commerce_shipping_pane_checkout_form in includes/commerce_shipping.checkout_pane.inc
Checkout pane callback: builds a shipping quote selection form.
commerce_shipping_pane_checkout_form_submit in includes/commerce_shipping.checkout_pane.inc
Checkout pane callback: submit the shipping checkout pane.
commerce_shipping_pane_checkout_form_validate in includes/commerce_shipping.checkout_pane.inc
Checkout pane callback: validate the shipping service selection and details.
commerce_shipping_service_rate_order in ./commerce_shipping.module
Adds a shipping rate to the given order object for the specified service.

File

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

Code

function commerce_shipping_service_callback($shipping_service, $callback) {

  // If the specified callback function exists, return it.
  if (!empty($shipping_service['callbacks'][$callback]) && function_exists($shipping_service['callbacks'][$callback])) {
    return $shipping_service['callbacks'][$callback];
  }

  // Otherwise return FALSE.
  return FALSE;
}