Today we are going to see how to move elements in Magento 2.
Magento 2 is famous for releasing new functionality, features and approaches. We are going to talk about the new feature of templating.
Magento 2 offers this functionality where we can move blocks or let’s say containers to different places and that too within the page. With the help of the layout file, we can move containers & blocks.
Let’s see how to move elements in Magento 2
We can use this tiny piece of code in layout file to move containers & blocks.
1 |
<move element="name of conatiner or block" destination="destination block or container name" /> |
Let’s see the example. Here we are going to move price block directly at product page.
Below code will do the magic.
1 2 3 |
<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> |
VOILA!! You see. That’s how a tiny piece of code will help us to move elements in Magento 2.
[crayon-63d3e9d613096658929554/] Using above fucntion Images can be imported directly from...
Override view block using di.xml and add the below code...
You can check a list of called layout XML for...
Follow the below steps to install and set up PWA...
If you want to remove all leading zero's from order,...
Let our Magento expert connect to discuss your requirement.
We offer Magento
certified developers.
Our Magento clientele
is 500+.
We sign NDA for the
security of your projects.
We’ve performed 100+
Magento migration projects.
Free quotation
on your project.
Three months warranty on
code developed by us.