enter image description here

I am trying to move minicart-wrapper into page-wrapper, right now it is in the parent(header). What i have done so far,

Path where i am over riding magento core module in my extended theme, my parent theme is luma:


<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <move element="minicart.wrapper" destination="page.header" after="-"/>

Path of the default module that i am over riding in my theme: Magento/vendor/magento/module-checkout/view/frontend/layout/default.xml

I am following this (Rearrange elements) http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/xml-manage.html

I am confused how if they are referring to element by class or something else. I am doing it using class in my code.

Please help!!! Thanks in advance.

| improve this question | | | | |



here you find:

<block class="Magento\Checkout\Block\Cart\Sidebar" name="minicart" as="minicart" after="logo" template="cart/minicart.phtml">

I suspect this is the element you want to move.

To find the element you want it to move to check:


Here you will find the element:

<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
    <update handle="empty"/>
    <referenceContainer name="page.wrapper">
        <container name="checkout.header.container" as="checkout_header_container" label="Checkout Page Header Container" htmlTag="header" htmlClass="page-header" before="main.content">
            <container name="checkout.header.wrapper" label="Checkout Page Header" as="checkout_header_wrapper" htmlTag="div" htmlClass="header content"/>

So you should be able to change it like:

<?xml version="1.0"?>
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <move element="minicart" destination="checkout.header.container" />

How I found the elements generally speaking:

You can enable layout hints in the admin backend. But I never found this useful so far. So typically I just search in my IDE over all of the magento source code for some unique element like ie. a html class name or similar. You will then often find the code either in a layout xml, phtml or html. If you found it in xml it should be simple to see the name of the element where the htmlClass is set. If it's in an html or phtml file you need to search this file name in the layout(.xml) instruction files so you can find at what element it is attached. That gives you the element name then you can use for further actions. To finally see if I got the right element I add a remove instruction into the appropriate layout file.

| improve this answer | | | | |
  • Yes you are right i am looking to move the block you mentioned When using this, <move element="minicart" destination="page.header" after="-"/> Its not making any difference – Abdul Moiz Mar 10 '17 at 14:07
  • And when using this, with body and page tags, its not rendering the cart, <page xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <move element="minicart" destination="page.header" after="-"/> </body> </page> – Abdul Moiz Mar 10 '17 at 14:10
  • 1
    I have successfully moved the element to the page.wrapper with the code above in default.xml where you placed it. Have you flushed your caches? (especially layout instructions, I have disabled all caches on dev) – steros Mar 10 '17 at 14:14
  • 1
    I updated the answer, it should work but I haven't tested it again. – steros Mar 10 '17 at 14:48
  • 1
    I've updated the answer. I can't test it now unfortunately cause I have completely removed the header and I don't have a blank installation ready now, sorry! – steros Mar 10 '17 at 15:03

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.