Right now I have the following default.xml file...

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <referenceContainer name="header">
        <container name="header.panel.wrapper" htmlClass="topbar" htmlTag="div" before="-">
            <block class="Magento\Framework\View\Element\Template" name="top.links" template="Magento_Theme::html/topbar.phtml"/>
        <container name="header-wrapper" label="Page Header" as="header-wrapper" htmlTag="div" htmlClass="header">

            <block class="Magento\Framework\View\Element\Template" name="header" template="Magento_Theme::html/header.phtml"/>

and I'm trying to make it so I can render the minicart inside of the file topbar.phtml. I've tried every combination of...

<move element="minicart" destination="header" />
<move element="minicart" destination="top.links" />
<move element="minicart" destination="header-wrapper" />

...that I can think of. But no where I put it, it'll either error out or just not render it with...

<?php echo $this->getChildHtml('minicart') ?>

2 Answers 2


Try this:

<move element="minicart" destination="header.panel.wrapper" before="top.links" />

or this:

<move element="minicart" destination="header.panel.wrapper" after="top.links" />

Depending on whether you want to move it before or after the top.links.


You are close to the correct solution.

Keep in mind that blocks in other blocks to not render if not called with getChildHtml, you need to move it to a container, that way it will render automatically.

See the container named header.panel, if you move it there it will render.

Also, if you want this to happen on all the pages, I would suggest you edit the default.xml layout under the Magento_Theme module : Magento_Theme\view\frontend\layout\default.xml.

Note: that I do not recommend you make the change in that file but you rather extend it in your theme and make the change there!

 <move element="minicart" destination="header.panel"/>

That should be the line you add after the <body> tag in the default.xml file.

<move element="minicart" destination="header.panel" before="-"/>

<move element="minicart" destination="header.panel" after="-"/>

The above will change the location versus the rest of the blocks in that container.

It will render, keep in mind that it's gray on gray so you might not see it :) I recommend adding some CSS to make the minicart white.


Your Answer

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

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