You are here

function hook_commerce_checkout_order_can_checkout in Commerce Core 7

Allows modules to confirm that an order may proceed to checkout.

If any implementation of this hook returns TRUE, the given order can proceed to checkout. However, if no implementations of this hook exist and return TRUE, the checkout router will simply redirect away to the front page.

Parameters

$order: The order being confirmed for checkout.

Return value

Boolean value indicating whether or not the order can proceed to checkout.

1 function implements hook_commerce_checkout_order_can_checkout()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

commerce_product_reference_commerce_checkout_order_can_checkout in modules/product_reference/commerce_product_reference.module
Implements hook_commerce_checkout_order_can_checkout().
1 invocation of hook_commerce_checkout_order_can_checkout()
commerce_checkout_order_can_checkout in modules/checkout/commerce_checkout.module
Determines whether or not the given order can proceed to checkout.

File

modules/checkout/commerce_checkout.api.php, line 57
Hooks provided by the Checkout module.

Code

function hook_commerce_checkout_order_can_checkout($order) {

  // Allow orders with one or more product line items to proceed to checkout.
  // If there are no line items on the order, redirect away.
  $wrapper = entity_metadata_wrapper('commerce_order', $order);
  if (commerce_line_items_quantity($wrapper->commerce_line_items, commerce_product_line_item_types()) > 0) {
    return TRUE;
  }
}