0

Minicart is not showing cart count properly at the time of not logging in. I had tried to show statically into the id condition but the when loading the 0 is shown after load it is not showing, I think the problem is that from the getCartParam('summary_count') the value is not passing if there is no zero is coming, it is not showing inside the if condition I will give the minicart js code below please suggest some solution for this.

And please tell how to check the null in knockout Js magento 2.3?

<span class="counter qty empty"
              data-bind="css: { empty: !!getCartParam('summary_count') == false }, blockLoader: isLoading">
            <span class="counter-number"><!-- ko text: getCartParam('summary_count') --><!-- /ko --></span>
            <span class="counter-label">
            <!-- ko if: getCartParam('summary_count') -->
                <!-- ko text: getCartParam('summary_count') --><!-- /ko -->
                <!-- ko i18n: 'items' --><!-- /ko -->
            <!-- /ko -->

            <!-- ko if: getCartParam('summary_count') == 0 -->
                0
                <!-- ko i18n: 'items' --><!-- /ko -->   
            <!-- /ko -->
            </span>
            <span class="counter-number"><!-- ko text: **cart().summary_count || 0** --><!-- /ko --></span> 

    

1 Answer 1

0

Here is :

<!-- ko if: (getCartLineItemsCount() === 0) -->
                    <span translate="'No Item in Cart'"/>
<!--/ko-->

<!-- ko if: (getCartLineItemsCount() === 1) -->
                    <span translate="'Item in Cart'"/>
<!--/ko-->

<!-- ko if: (getCartLineItemsCount() > 1) -->
                    <span translate="'Items in Cart'"/>
<!--/ko-->

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.