0

When I logged out from my website, its successfully getting logout on the current page. But, when I click any other page for example clicks on the logo to get the homepage, it still shows as logged instead of getting logged out. When I refresh the page, it's showing fine. My all cache types are enabled. Check once the screenshot.

Cache types are enabled

Steps to reproduce the issue:

  1. Open once the website Depoto
  2. Click on login/signup from header links with the provided credentials below.
  3. You can observe the account is logged in.
  4. Now, click on log out from header links. Then you observe the account is logged out.
  5. Now, click on the Logo then you will go to the homepage.
  6. Here, you see the account is still logged in.
  7. Now refresh the page by ctrl + shift + R.Then you see the account is logged out.

Website user credentials:

username: teja.bhagavan1@gmail.com
Password: Test@123
5
  • Have you added any custom module for login? You are getting that issue because of full page cache and block caches. Once you disable those cache it will work fine. But I would suggest check actual cause of it like any login module creating issue.
    – kunj
    Jul 1, 2020 at 7:50
  • @kunj, really very thankful your comment with full page cache. I just disabled the full page cache then it works. good. thanks and add your comment as answer. And let me know the issue if I not disable full page cache please Jul 1, 2020 at 12:47
  • If you will disable full page cache it will affect on performance. Actually with full page cache it will work in fresh magento. That issue must related to the any custom module.
    – kunj
    Jul 1, 2020 at 13:02
  • @kunj, i added magecompmobilelogin plugun for otp login. I disabled that and checked then also issue same. But what causes the issue ? Jul 1, 2020 at 13:14
  • To know the actual cause need to test every module and server configuration. I am sure it is related to external module
    – kunj
    Jul 1, 2020 at 16:09

2 Answers 2

2

Actually this issue is related to Magento full page or block cache. But with fresh magento it should work properly so issue is related to custom module which used for customer login or session.

0

It IS working propertly. It's full page cache issue. To archieve Your goal use ajax or customer sections. Example below. In etc/frontend/di.xml

<type name="Magento\Checkout\CustomerData\Cart">
       <plugin name="interceptCustomerDataCart" type="Vendor\Module\Plugin\CustomerData\Cart"/>
   </type>

In Vendor\Module\Plugin\CustomerData\Cart.php class With function

public function aroundGetSectionData(CustomerDataCart $subject,\Closure $proceed){
$data = $proceed();
$atts=['some_attr'=>'Your value'];
return array_merge($data, $atts);
}

And finally use knockout in phtml like

<!-- ko text: getCartParam('some_attr') --><!-- /ko -->
1
  • I dont know how to do this. Please add the full path and the content for me. Thanks Jun 30, 2020 at 13:30

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.