Display menu Shopping cart (# items) and total amount In the user menu, I added a menu link to the shopping cart:

Title: "Shopping cart (# items)"

Path: "cart/my"

How to add the total amount of the order, at the end of the title ?

I think it is necessary to use the file "template.php" of my theme.

/**
 * Implements hook_menu().
 */
function commerce_cart_menu() {
  $items = array();

  $items['cart'] = array(
    'title' =&gt; 'Shopping cart',
    'page callback' =&gt; 'commerce_cart_view',
    'access arguments' =&gt; array('access content'),
    'file' =&gt; 'includes/commerce_cart.pages.inc',
  );

  $items['cart/my'] = array(
    'title' =&gt; 'Shopping cart (# items)',
    'title callback' =&gt; 'commerce_cart_menu_item_title',
    'title arguments' =&gt; array(TRUE),
    'page callback' =&gt; 'commerce_cart_menu_item_redirect',
    'access arguments' =&gt; array('access content'),
    'type' =&gt; MENU_SUGGESTED_ITEM,
  );

  $items['checkout'] = array(
    'title' =&gt; 'Checkout',
    'page callback' =&gt; 'commerce_cart_checkout_router',
    'access arguments' =&gt; array('access checkout'),
    'type' =&gt; MENU_CALLBACK,
    'file' =&gt; 'includes/commerce_cart.pages.inc',
  );

  // If the Order UI module is installed, add a local action to it that lets an
  // administrator execute a cart order refresh on the order. Modules that
  // define their own order edit menu item are also responsible for defining
  // their own local action menu items if needed.
  if (module_exists('commerce_order_ui')) {
    $items['admin/commerce/orders/%commerce_order/edit/refresh'] = array(
      'title' =&gt; 'Apply pricing rules',
      'description' =&gt; 'Executes the cart order refresh used to apply all current pricing rules on the front end.',
      'page callback' =&gt; 'drupal_get_form',
      'page arguments' =&gt; array('commerce_cart_order_refresh_form', 3),
      'access callback' =&gt; 'commerce_cart_order_refresh_form_access',
      'access arguments' =&gt; array(3),
      'type' =&gt; MENU_LOCAL_ACTION,
      'file' =&gt; 'includes/commerce_cart.admin.inc',
    );
  }

  return $items;
}

/**
 * Returns the title of the shopping cart menu item with an item count.
 */
function commerce_cart_menu_item_title() {
  global $user;

  // Default to a static title.
  $title = t('Shopping cart');

  // If the user actually has a cart order...
  if ($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 there are more than 0 product line items on the order...
    if ($quantity &gt; 0) {
      // Use the dynamic menu item title.
      $title = format_plural($quantity, 'Shopping cart (1 item)', 'Shopping cart (@count items)');
    }
  }

  return $title;
}
You can use https://www.drupal.org/project/menu_badges to accomplish that.


  Once enabled, go to Administration > Structure > Menus, and click
  "list links" next to the menu containing the target item. Click "edit"
  next to the item and select the badge to display with the Display Menu
  Badge select box.


Or you can set the parent menu item of the Shopping cart (# items) link provided by the cart module to your menu. This menu item is provided by commerce and by default can be found in the navigation menu at admin/structure/menu/manage/navigation