Views: Display Total number of products in commerce kickstart shopping cart
In menu badges module check line no 335 code

/**
 * Drupal Commcerce cart items count callback.
 * @param array $arguments
 */
function menu_badges_commerce_cart_item_count() {
  global $user;

  if (module_exists('commerce_cart') &amp;&amp; $order = commerce_cart_order_load($user-&gt;uid)) {
    // Count the number of product line items on the order.
    $wrapper = entity_metadata_wrapper('commerce_order', $order);
    $quantity = commerce_line_items_quantity($wrapper-&gt;commerce_line_items, commerce_product_line_item_types());
    if ($quantity &gt; 0) {
      return $quantity;
    }
  }
  return NULL;
}


You can get total quantity using below code also...

  global $user;
  $order = commerce_cart_order_load($user-&gt;uid);
  $wrapper = entity_metadata_wrapper('commerce_order', $order);
  $quantity_total = 0;
  foreach ($wrapper-&gt;commerce_line_items as $delta =&gt; $line_item_wrapper) {
    $quantity = $line_item_wrapper-&gt;quantity-&gt;value();
    $quantity_total = $quantity_total + $quantity;
  }


Commerce modules does not provide view handler for Quantity Total.. If you are interested you can create one and share it with community.. Other wise you can use views php module to achieve same...