Magento 2 – How to Check If Customer Login Or Not? / Learn Magento 2 Adobe Commerce / By Saphal PHPprotected $customerSession; public function __construct( \Magento\Customer\Model\SessionFactory $customerSession ) { $this->customerSession = $customerSession; } public function isLoggedIn() { return $this->customerSession->create()->isLoggedIn(); }use isLoggedIn() method to get value