You are here

function commerce_cart_order_load in Commerce Core 7

Loads the shopping cart order for the specified user.

Parameters

$uid: The uid of the customer whose cart to load. If left 0, attempts to load an anonymous order from the session.

Return value

The fully loaded shopping cart order or FALSE if nonexistent.

11 calls to commerce_cart_order_load()
CommerceBaseTestCase::createDummyOrder in tests/commerce_base.test
Create a dummy order in a given status.
CommerceCartTestCaseMultiProducts::testCommerceCartOrder in modules/cart/tests/commerce_cart.test
Test if the product is present in the order stored in db.
CommerceCartTestCaseSimpleProduct::testCommerceCartOrder in modules/cart/tests/commerce_cart.test
Test if the product is present in the order stored in db.
commerce_cart_block_view in modules/cart/commerce_cart.module
Implements hook_block_view().
commerce_cart_checkout_router in modules/cart/includes/commerce_cart.pages.inc
Redirects invalid checkout attempts or displays the checkout form if valid.

... See full list

File

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

Code

function commerce_cart_order_load($uid = 0) {

  // Retrieve the order ID for the specified user's current shopping cart.
  $order_id = commerce_cart_order_id($uid);

  // If a valid cart order ID exists for the user, return it now.
  if (!empty($order_id)) {
    return commerce_order_load($order_id);
  }
  return FALSE;
}