Magento 2 customer logged in or not

You may also like...

2 Responses

  1. asha says:

    Hi, I want to show the default welcome message only when the customer is logged in. Please help me to solve this. Thank you.

  2. Chris says:

    Very nicely written article! I wanted to point out one small typo in your post 🙂

    public isCustomerLoggedIn() {
    return $this->_customerSession->isLoggedIn();
    }

    should be:

    public function isCustomerLoggedIn() {
    return $this->_customerSession->isLoggedIn();
    }

    You simply forgot to add “function” to the function. Cheers!

Leave a Reply

Your email address will not be published. Required fields are marked *