We want to check in the minicart if the customer is loggedin.

<!-- ko if: isCustomerLoggedIn == 1 -->

Does not seem to work well for the mini cart. This only works when you are visually in the checkout. When you are in the category or on the productpage, this does not work.

So how can we always check in the mini cart if the customer is loggedin?

<!-- ko ifnot: isCustomerLoggedIn() -->

<!-- /ko -->

I found it effective in checking customer is login

  • Sadly that does not work, we get the JS error: Message: isCustomerLoggedIn is not a function. (In 'isCustomerLoggedIn()', 'isCustomerLoggedIn' is true)
    – JGeer
    May 21 at 14:30
  • you can use 'Magento_Customer/js/model/customer'
    – nhungo duc
    May 22 at 10:33
  • vendor/magento/module-checkout/view/frontend/web/js/view/form/element/email.js vendor/magento/module-customer/view/frontend/web/js/model/customer.js vendor/magento/module-customer/view/frontend/web/js/customer-data.js . I see magento have some login test case please read through it
    – nhungo duc
    May 22 at 10:34
  • rakeshjesadiya.com/…
    – nhungo duc
    May 22 at 10:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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