Magento 2 customer logged in or not

You may also like...

4 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!

  3. Rhodri D says:

    Missing underscore in the class var too!

  4. Aaron M says:

    YAY! Another incomplete solution!

Leave a Reply