You are here

function commerce_cart_order_session_exists in Commerce Core 7

Checks to see if any order ID or a specific order ID exists in the session.

Parameters

$order_id: Optionally specify an order ID to look for in the commerce_cart_orders session variable; defaults to NULL.

$completed: Boolean indicating whether or not the operation should look in the completed orders array instead of the active cart orders array.

Return value

Boolean indicating whether or not any cart order ID exists in the session or if the specified order ID exists in the session.

3 calls to commerce_cart_order_session_exists()
commerce_cart_commerce_checkout_complete in modules/cart/commerce_cart.module
Implements hook_commerce_checkout_complete().
commerce_cart_order_can_refresh in modules/cart/commerce_cart.module
Checks if a cart order should be refreshed based on the shopping cart refresh settings on the order settings form.
commerce_cart_order_id in modules/cart/commerce_cart.module
Returns the current cart order ID for the given user.

File

modules/cart/commerce_cart.module, line 1261
Implements the shopping cart system and add to cart features.

Code

function commerce_cart_order_session_exists($order_id = NULL, $completed = FALSE) {
  if ($cart_provider = commerce_cart_get_provider()) {
    return $cart_provider
      ->cartExists($order_id, $completed);
  }
  return FALSE;
}