I want to move minicart block to top.links block.

This did the trick for me:

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

Now, I added a custom block with custom .phtml file to the top.links block too:

<referenceBlock name="top.links">
            <block class="Magento\Framework\View\Element\Template" name="fw.account" template="Magento_Theme::html/FlavourWarehouseAccountDropdown.phtml"/>

That works as expected too.

However, I need the block "fw.account" to be rendered before the "minicart". I tried adding the "before" and "after" to blocks but with no success.

How can I add the fw.account block before minicart block? Adding before="minicart" to fw.account block didn't work...

3 Answers 3


Please use below code to move minicart to toplinks :

<move element="minicart" destination="top.links" after="fw.account" />
  • 1
    This is correct answer :) thank you! see my answer for explanation to what happen :) upvoted ;)
    – Greg
    Dec 6, 2018 at 14:18
  • If this is the correct answer then please mark it as a correct so that it will help to others!! Dec 7, 2018 at 5:19
<move element="minicart" destination="top.links" before="fw.account" />
  • Actually this solved my problem, however, is not completly the correct answer : see my answer. Upvote from me :)
    – Greg
    Dec 6, 2018 at 14:19

I found out that the XML was working correct from the first time. I had a css class on both elements with float: right property, so when they were rendered the first element were pushed back after the second element, therefore it looked like it wasn't working properly.

So technically, both answers I received from @SenhaPanchal and @Divya are correct.

Adding the after="fw.account is the correct answer to how to place the element.

However, with the float: right CSS property on both elements, this had to be switched around so before="fw.account" in conjunction with float: right actully resulted in the minicart rendering after the fw.account element.

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.