0

I am trying to use login session on magento/catalog/view/base/templates/product/price/amount/default.phtml to hide price from users not logged in.

However, it seems not working well with

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customerSession = $objectManager->get('Magento\Customer\Model\Session');
if($customerSession->isLoggedIn()) {
    // customer login action
}

As well, I cannot find \Magento\Framework\App folder in my project. But, it seems working well tho. Is there any way that I can find this folder, and that makes it able to get login status?

  • You will find that folder in lib/internal/Magento or vendor/magento/framework. – amitshree Jan 9 at 6:34
  • Due to enabled full page cache you might not be getting correct data. Check different ways to achieve it which is mentioned in the thread magento.stackexchange.com/q/91897/9169 – amitshree Jan 9 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.