This question already has an answer here:
So, I followed the steps in the 2nd answer (by Miroslav Petroff) on this question: How can i check whether user is logged in or not in magento 2.0
The if statement only works correctly when viewing pages like Wishlist, My Account, Cart, etc. Currently on the Homepage, Catalog pages, Product pages, and possibly others, my if statement is returning 'not-logged-in'.
if ( $helper->isLoggedIn() ): echo ' logged-in'; else: echo ' not-logged-in'; endif;
Anyone ideas what might make these pages return different results?