cancel
Showing results for 
Search instead for 
Did you mean: 

trouble moving search and minicart to header panel

Re: trouble moving search and minicart to header panel

No, afraid not.

 

I asked the theme developer, they said to just edit header.phtml as I did previously, but as we saw that only works for the minicart, not the top search.

Very odd.

While experimenting I was able to get it to appear when I put code in my child theme's default.xml file to "move" the search bar to the top.links section, but in every other case it just disappeared.

 

Does it need to be in a special container?

Re: trouble moving search and minicart to header panel

@ed_geis 

 try this may be it work in your theme default.xml file.

<move element="top.search" destination="header-wrapper" after="-" />

If this work accept it solution and give kudos.

Re: trouble moving search and minicart to header panel

Negative, that didn't work either. Theme developer had nothing to offer, either, other than "it should work".

 

I'll keep trying different approaches. I must be missing something...

Re: trouble moving search and minicart to header panel

I know this is old, but I landed while searching for the same issue, so figured my solution might help someone else. This is for 2.4.1.

 

In our custom theme, I had to move top.search into the custom header block (in app/design/frontend/[theme_name]/default/Magento_Theme/layout/default.xml):

 

<move element="top.search" destination="custom.header" />

 

That custom.header block had it's own .phtml template file (app/design/frontend/[theme_name]/default/Magento_Theme/templates/html/custom-header.phtml) where I added this code to get it to show up in the right place. Note that we have to use topSearch here, and not top.search (I have no idea why the name changes from top.search):

 

<div class="header-wrapper">
    <div class="header-block-logo">
        <?= $this->getChildHtml('logo'); ?>
    </div>
    <div class="header-block-nav">
        <?= $this->getChildHtml('nav-desktop'); ?>
    </div>
    <div class="header-block-search">
        <?= $this->getChildHtml('topSearch'); ?>
    </div>
    <div class="header-block-cart">
        <?= $this->getChildHtml('minicart'); ?>
    </div>
...