How can I get the cart total item? I tried using a “length” filter but it’s not working with that
You can use the totalQty method to fetch total items from the cart. It’s a predefined method in the commerce plugin to get total items. Also you can find other methods like this in the documentation of the craft commerce plugin.
Right now for your answer use below totalQty method to get total item count.
{{ craft.commerce.carts.cart.totalQty }}