How can I view & access all available variables for a Drupal Commerce cart? For theming purposes I'm trying to access any and all available Drupal commerce cart variables. For starters, I want to give the user feedback regarding the cart in the global nav.

I thought these vars would be available within the $_SESSION var but not so(?).

an example of what i’m trying to do is as follows, via some pseudo code to be put into the global nav…

&lt;!—- Global nav—-&gt;
&lt;li&gt;Cart 
    &lt;?php  if($items_in_cart == true) {
        echo ‘*’;
     } ?&gt;&lt;/li&gt;


or,....

&lt;?php
if($items_in_cart) {
print $total_items_in_cart;
}?&gt;
You can use the function commerce_cart_order_load &amp; commerce_line_item_load() to load the current order(cart) object &amp; order product objects respectively:

  global $user;
  $order = commerce_cart_order_load($user-&gt;uid);
  $cart_items = array();
  foreach ($order-&gt;commerce_line_items[LANGUAGE_NONE] as $line_item) {
    $cart_items[] = commerce_line_item_load($line_item['line_item_id']);
  }


In this example, $order contains the Commerce order(cart) object for the current user &amp; $cart_items contain an array of line item (order products) objects.