0

I'm trying to move the cart next to the search bar here but it isn't working.

enter image description here

A user has asked the same question here:

Move Mini Cart (Magento 2)

When I put in

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

or

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

My cart ends up in the top right corner on the first code and on the second one, it disappears.

Code:

code

I have moved my search bar by adding the below to default.xml:

        <move element="top.search" destination="header-wrapper" after="logo" />
  • The minicart is not completely gone. Is this what you want? – Greg Apr 26 '18 at 10:56
  • @BareFeet No, I want to move the cart next to the search bar as shown in the first picture. The only way I can move it with CSS is by adding margin-right but this throws out the 'drop down' that appears when you click it. – cz84 Apr 26 '18 at 10:59
4

You can try below code

<move element="minicart" destination="header-wrapper" after="top.search"/>
| improve this answer | |
  • This doesn't work, it just stays in the same place as shown in the 1st picture. – cz84 Apr 26 '18 at 10:57
  • Then you should manage using css because layout was correct I think – hweb87 Apr 26 '18 at 11:00
  • The cart has display: inline-block; and vertical-align: top; set to it in CSS but when removing these options and adding float: left; it does nothing.. the only way I can move it is by using margin-right but this messes up the drop down that appears when you click the cart. – cz84 Apr 26 '18 at 11:02
  • Could you please try float:right; – hweb87 Apr 26 '18 at 11:04
  • I've managed to do it.. your code above is correct and I had to apply float: left; - I was applying the CSS to the wrong class, the correct one is: .minicart-wrapper – cz84 Apr 26 '18 at 11:20

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.