get('\Magento\Customer\Model\Session'); $urlInterface = $objectManager->get('\Magento\Framework\UrlInterface'); if (!$customerSession->isLoggedIn()) { $customerSession->setAfterAuthUrl($urlInterface->getCurrentUrl()); $customerSession->authenticate(); } $want_to_buy_id = $block->getWantToBuyId(); $customer = $block->getCustomer(); $email = ""; if ($customer) { $email = $customer->getEmail(); } ?>