How to show cart with number of items in Ubercart? For his cart, my client wants a cart icon with the number of items in it. Not a list of all items. I searched around a little bit but didn't find anything.
As for D8 latest version, it looks like uc_cart_get_contents is not working anymore.  So here is how I managed to do it : 

/** @var \Drupal\uc_cart\CartManager $cartManager */
$cartManager = \Drupal::service('uc_cart.manager');
$items = $cartManager-&gt;get()-&gt;getContents();
$variables['nbr_cart_items'] = count($items);