I was trying to pull the logo_src from the database table core_config_data but can't return it on the frontend. I was trying to do this via objectManager and know that this is not the correct way. However I want to test if the idea that I have works. The odd thing is I can get all other values except this one.

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$conf = $objectManager->get('Magento\Framework\App\Config\ScopeConfigInterface')->getValue('design/header/logo_src');

What I eventually want to achieve is to combine this with the storeswitcher and do something like this. In this way I can get the uploaded logo's from each store and display it in an overview.

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$conf = $objectManager->get('Magento\Framework\App\Config\ScopeConfigInterface')->getValue('design/header/logo_src', $block->getCurrentStoreId()

I know the Magento 1 equivalent (see the code below), but find it hard to translate this to Magento 2. Does anybody have a solution for me?

Mage::getDesign()->getSkinUrl(Mage::getStoreConfig('design/header/logo_src', $storeId));

Current code

    <?php foreach ($block->getGroups() as $_group): ?>
    <?php if (!($_group->getId() == $block->getCurrentGroupId())): ?>
        <a href="#" data-post='<?= /* @noEscape */ $block->getTargetStorePostData($_group->getDefaultStore()) ?>'>
            <?= $block->escapeHtml($_group->getName()) ?>
            $objectManager =  \Magento\Framework\App\ObjectManager::getInstance();
            $logo = $objectManager->get('\Magento\Theme\Block\Html\Header\Logo');
            echo $logo->getLogoSrc();           
    <?php endif; ?>
    <?php endforeach; ?>

2 Answers 2


Try the below code:

$objectManager =  \Magento\Framework\App\ObjectManager::getInstance();
$logo = $objectManager->get('\Magento\Theme\Block\Html\Header\Logo');
echo $logo->getLogoSrc();
  • Hi, This gives me the same effect as the following code which I added already. <?= $block->getLayout()->getBlock('logo')->getLogoSrc() ?> Jul 23, 2018 at 14:56
  • It shows the same logo URL over and over and over Jul 23, 2018 at 14:57
  • What do you want then? You want logo store wise? Jul 23, 2018 at 14:59
  • Exactly, that is what i want to achieve :) Jul 23, 2018 at 15:02
  • On which file you are trying to call this code? Jul 23, 2018 at 15:06

Managed to solve it took a while but finally got it working the only thing left is to convert it to a Magento module without objectManager. If anyone has some adjustments to make it better please have a go.. :)

                $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
                $storeID = $_group->getDefaultStoreId();
                $folderName = \Magento\Config\Model\Config\Backend\Image\Logo::UPLOAD_DIR;
                $storeLogoPath = $objectManager->get('Magento\Framework\App\Config\ScopeConfigInterface')->getValue('design/header/logo_src', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeID);
                $path = '<img src="/pub/media/' . $folderName . '/' . $storeLogoPath . '"/>';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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