Projet

Général

Profil

Révision b858700c

Ajouté par Assos Assos il y a environ 10 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/commerce/modules/checkout/commerce_checkout.api.php
41 41
  }
42 42
}
43 43

  
44
/**
45
 * Allows modules to confirm that an order may proceed to checkout.
46
 *
47
 * If any implementation of this hook returns TRUE, the given order can proceed
48
 * to checkout. However, if no implementations of this hook exist and return
49
 * TRUE, the checkout router will simply redirect away to the front page.
50
 *
51
 * @param $order
52
 *   The order being confirmed for checkout.
53
 *
54
 * @return
55
 *   Boolean value indicating whether or not the order can proceed to checkout.
56
 */
57
function hook_commerce_checkout_order_can_checkout($order) {
58
  // Allow orders with one or more product line items to proceed to checkout.
59
  // If there are no line items on the order, redirect away.
60
  $wrapper = entity_metadata_wrapper('commerce_order', $order);
61

  
62
  if (commerce_line_items_quantity($wrapper->commerce_line_items, commerce_product_line_item_types()) > 0) {
63
    return TRUE;
64
  }
65
}
66

  
44 67
/**
45 68
 * Allows modules to perform business logic when an order completes checkout.
46 69
 *

Formats disponibles : Unified diff