Something like this should work
app/code/Xigen/Cart/Helper/Quote.php
namespace Xigen\Cart\Helper;
use Magento\Framework\App\Helper\AbstractHelper;
class Quote extends AbstractHelper
{
/**
* @param \Magento\Framework\App\Helper\Context $context
*/
public function __construct(
\Magento\Framework\App\Helper\Context $context,
\Magento\Checkout\Model\Cart $cart
) {
$this->cart = $cart;
parent::__construct($context);
}
public function getAllVisibleItems() {
return $this->cart->getQuote()->getAllVisibleItems();
}
public function getAllVisibleItemsCount() {
return count($this->getAllVisibleItems());
}
}
Then in template for example
$visibleItems = $this->helper('\Xigen\Cart\Helper\Quote')->getAllVisibleItemsCount();