How to add a dynamic cart link to the user menu?
You can create a new menu programatically through menu hooks, and a great source for sample code and explanation is the menu_example portion of the Examples Module.

For example

function mymodule_menu() {
     $items['cart/new_menu_item'] = array(
    'title' =&gt; 'Shopping cart (# items)',
    'title callback' =&gt; 'mymodule_new_menu_item_title',
    'title arguments' =&gt; array(TRUE),
    'page callback' =&gt; 'mymodule_new_menu_item_redirect',
    'access arguments' =&gt; array('access content'),
    'type' =&gt; MENU_SUGGESTED_ITEM, 
  );
  return $items;
}