How to show different logo when the user is logged in?

  • follow this answer and in helper check customer is login or not then pass logo path as per your need
    – Piyush
    Jan 5, 2018 at 16:25
  • can you give me more details please Jan 5, 2018 at 16:29
  • what more details you need? if you follow that answer you will achieve what you need with little modifications
    – Piyush
    Jan 5, 2018 at 16:30
  • so i replace <arguments> <argument name="logo_file" xsi:type="string">images/logo.png</argument> <argument name="logo_img_width" xsi:type="number">192</argument> <!--<argument name="logo_img_height" xsi:type="number">50</argument>--> </arguments> with <argument name="logo_file" xsi:type="helper" helper="Namespace\ModuleName\Helper\Data::getLogoImage"></argument> where i can find helper file? Jan 5, 2018 at 16:35
  • 1
    Sorry friend I am little bit busy, will surely help you when I get some time.
    – Piyush
    Jan 5, 2018 at 16:51

1 Answer 1


You can set different logo while customer is logged in using a helper method, You have to Create a custom module for this.

In your layout you have to pass helper method for logo path,By adding below code in file


<argument name="logo_file" xsi:type="helper" helper="Namespace\ModuleName\Helper\Data::getLogoImage"></argument>

After that in your modules helper file you have to add below code


    namespace Namespace\ModuleName\Helper;

    class Data extends \Magento\Framework\App\Helper\AbstractHelper
        protected $_request;
        protected $_session;

        public function __construct
            \Magento\Framework\App\Request\Http $request,
            \Magento\Customer\Model\Session $session
        ) {
            $this->_request = $request;
            $this->_session = $session;

        public function getLogoImage()
            if ($this->_session->isLoggedIn()) {
                $logo =  'path/to/logo/for/logged_in/customer.png';
            } else {
                $logo = 'path/to/logo/for/guest/customer.png';

            return $logo;

Note: Change Namespace and ModuleName based on your custom Module

  • What if the logo is set in the admin?
    – Ben Crook
    Jan 8, 2018 at 13:56
  • @BenCrook in that case we have to replace logo path with storeConfig value
    – Piyush
    Jan 8, 2018 at 15:14
  • is there a step by step procedure easy to use to achieve this objective? Jan 10, 2018 at 16:08
  • @Piyush Can you please explain how we can call it from logo.phtml or through block, and where to define this argument inside the block or some refrenceBlock? Thankyou
    – JN_newbie
    May 15, 2018 at 12:17
  • @Piyush I have done it through using the helper object in logo.phtml file.
    – JN_newbie
    May 15, 2018 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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