Magento – Magento 2 moving top.search block before minicart

layoutmagento2

I seem to being having an issue with moving referenceblocks.

I have created a child theme based off of Blank. In my default.xml file, I moved both minicart and top.search blocks into header.panel like so

<move element="top.search" destination="header.panel" before="minicart" />
<move element="minicart" destination="header.panel" after="top.search" />

but I can't get the minicart to be after the top.search. Can someone help me? Below is a screenshot of how it looks once I moved it.

enter image description here

Best Answer

if you want to move search bar and mini-cart into header panel try following

go to or create app/design/frontend/Vendor/theme/Magento_Theme/layout/default.xml

add below line just after body tag

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

run this command

php bin/magento cache:clean && php bin/magento cache:flush

if you created a new custom theme run this command

php bin/magento setup:upgrade && php bin/magento setup:static-content:deploy -f

min-cart will be there but if you have default theme then header panel and mini-cart color will be the same find just before search bar.

Related Topic