0

I want to change the logo that is being displayed in the checkout page. For rest of the pages the logo should remain same. Also, I should be able to manage this via admin panel.

Please check the attached screenshots:-

Please help.

Thanks in advance.

1 Answer 1

1

You can use helper

Override default.xml in your theme and add helper in logo_file argument

Magento_Theme/layout/default.xml

<argument name="logo_file" xsi:type="helper" helper="Vendor\Module\Helper\Data::getLogo"></argument>

In your helper, you can get logo based on current url like this.

<?php

namespace Vendor\Module\Helper;

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

    public function __construct
    (
        \Magento\Framework\App\Request\Http $request
    ) {
        $this->_request = $request;
    }

    public function getLogo()
    {
        if ($this->_request->getFullActionName() == 'checkout_index_index') {
            $logo =  'images/{{custom.png}}';
        } else {
            $logo = 'images/{{default.png}}';
        }

        return $logo;
    }
} 

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.