function hook_uc_cart_checkout_start in Ubercart 8.4
Same name and namespace in other branches
- 7.3 uc_cart/uc_cart.api.php \hook_uc_cart_checkout_start()
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
\Drupal\uc_order\OrderInterface $order: The order object to check out.
1 invocation of hook_uc_cart_checkout_start()
- CheckoutController::checkout in uc_cart/
src/ Controller/ CheckoutController.php - Builds the cart checkout page from available checkout pane plugins.
File
- uc_cart/
uc_cart.api.php, line 246 - Hooks provided by the Cart module.
Code
function hook_uc_cart_checkout_start(OrderInterface $order) {
if (in_array('administrator', $order
->getOwner()->roles)) {
\Drupal::messenger()
->addError(t('Administrators may not purchase products.'));
drupal_goto('cart');
}
}