You are here

function commerce_checkout_order_can_checkout in Commerce Core 7

Determines whether or not the given order can proceed to checkout.

This function operates as a confirmation rather than a falsification, meaning that any module implementing hook_commerce_checkout_order_can_checkout() can confirm the order may proceed to checkout.

The default core implementation is in commerce_product_reference.module and allows any order containing a product line item to proceed to checkout.

More complex logic can be implemented via hook_commerce_checkout_router().

Parameters

$order: The order being confirmed for checkout.

Return value

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

See also

commerce_product_reference_commerce_checkout_order_can_checkout()

1 call to commerce_checkout_order_can_checkout()
commerce_checkout_router in modules/checkout/includes/commerce_checkout.pages.inc
Redirects invalid checkout attempts or displays the checkout form if valid.

File

modules/checkout/commerce_checkout.module, line 957
Enable checkout as a multi-step form with customizable pages and a simple checkout pane API.

Code

function commerce_checkout_order_can_checkout($order) {
  $proceed = FALSE;

  // Manually invoke hook functions to use the bitwise operator that will update
  // the return value to TRUE if any implementation returns TRUE and ignore any
  // FALSE return values if it is already set to TRUE.
  foreach (module_implements('commerce_checkout_order_can_checkout') as $module) {
    $function = $module . '_commerce_checkout_order_can_checkout';
    $proceed |= $function($order);
  }
  return $proceed;
}