Reading list Switch to dark mode

    Move Elements In Magento2

    Updated 23 December 2019

    In this blog we will see how to move elements in magento2.
    Magento2 uses many new features and new approaches. We will see here new feature of templating. In Magento2, within the page we can move containers and blocks to different places. We can move blocks and containers with the help of layout file.

    Move Elements in Magento2

    Use following code snippet in layout file to move blocks and containers.

    <move element="name of conatiner or block" destination="destination block or container name" />

    Here is an example. We will move price block to media block on product page.
    Move Elements

    Now we will move the price block.

    <page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    	<move element="product.info.price" destination="product.info.media" />
    </page>

    Move Elements

    Searching for an experienced
    Magento 2 Company ?
    Find out More

    That’s all for moving elements in magento2 via layout file. If you have any query or issue, comment below.

    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    Be the first to comment.

    Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home