How to move block in Magento 2

0
31

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.

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

From: webkul