Skip navigation
Help

hook_uc_cart_checkout_start

7 uc_cart.api.php hook_uc_cart_checkout_start($order)

Takes action immediately before bringing up the checkout page.

Use drupal_goto() in the hook implementation to abort checkout and enforce restrictions on the order.

Parameters

$order: The order object to check out.

Related topics

1 invocation of hook_uc_cart_checkout_start()

File

ubercart/uc_cart/uc_cart.api.php, line 295
Hooks provided by the Cart module.

Code

function hook_uc_cart_checkout_start($order) {
  $account = user_load($order->uid);
  if (is_array($account->roles) && in_array('administrator', $account->roles)) {
    drupal_set_message(t('Administrators may not purchase products.', 'error'));
    drupal_goto('cart');
  }
}