Question

I want to display the total items count using Knockout, in Magento_Checkout::header/minicart.phtml, e.g. if I have 2 items with the same SKU in the basket then the total items count is 1.

I have tried using data-bind="text: getCartParam('items_count')" but this returns the total quantity (i.e. 2).

I could use <?php echo $this->helper('\Magento\Checkout\Helper\Cart')->getItemsCount(); ?> but I'd like to try and use a Knockout binding instead - is this possible?

Was it helpful?

Solution

Go to Admin -> Stores -> Configuration -> Sales -> Checkout -> MyCart -> Display Cart Summary

There you can change the setting.enter image description here

OTHER TIPS

you can use like this in template file

<span class="number"><!-- ko text: cartSidebar().items.length --><!-- /ko --></span>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top