Magento – Detect if a customer/user is logged in

Ever wondered if it’s possible enabling special features in phtml for logged in clients? Yes, it’s possible. Just with a simple if/else statement.

if ($this->helper('customer')->isLoggedIn()) {
    echo "Special content for customers";
else {
    echo "The special content is not visible for you, login first.";

Now you’re able to display for example your price only to customer that are logged in or give customers that are logged in a discount code.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top