In my main nav I have link and the url changes based upon if the customer is logged in. If the customer is login in the link is /shop/trade else the link is /trade.
My code is the following:
<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$customerSession = $objectManager->get('Magento\Customer\Model\Session');
if($customerSession->isLoggedIn()){
echo '/shop/trade';
}
else{
echo '/trade';
}
?>
The issue is though the block is being cached and thus the user does not see the updated link when logged in. I looked at using cacheable="false" on the block but I learnt this will disable caching on all pages since the nav is on all pages.
Whats the best way to sort this?