Created
July 17, 2018 14:04
-
-
Save 6ui11em/f13700957f8d7208ad0428dfd01f3edd to your computer and use it in GitHub Desktop.
Magento 2: Check if customer is logged in #magento2 #cache #customer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To avoid problems with full page cache | |
// https://github.com/magento/magento2/blob/4d2609343a950e9ee6b50cc4444469d50d82b139/app/code/Magento/Customer/Block/Account/Customer.php#L52 | |
public function customerLoggedIn() | |
{ | |
return (bool)$this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_AUTH); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment