Magento – Magento 2 : Edit Product view XML to move element

layoutmagento2product-page

I want to move the product description to appear right after the short description on our Magento 2.1 product detail page.

However My issue is I am not sure what the element name is for the short description and long description fields are.

I know I need something like

<move element="product_info_long_description" destination="product.info.main" after="product.info.short_description"/>

Here is my page layout xml I need to alter

<?xml version="1.0"?>
 <!--
   /**
    * Copyright © 2016 SW-THEMES. All rights reserved.
    * See COPYING.txt for license details.
    */
 -->
 <page layout="2columns-right" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
    <!--<script src="Magento_Catalog::js/jquery.zoom.min.js"/>-->
</head>
<body>
    <referenceContainer name="sidebar.additional">
        <block class="Smartwave\Porto\Block\Template" name="product_view_custom_block" before="-" template="Magento_Catalog::product/view/custom_block.phtml"/>
    </referenceContainer>
    <move element="product.info.stock.sku" destination="product.info.price" after="product.price.final"/>
    <move element="product.info.review" destination="product.info.main" before="product.info.price"/>
    <move element="catalog.product.related" destination="sidebar.additional" after="product_view_custom_block"/>
    <move element="product.info.overview" destination="product.info.main" after="product.info.review"/>
    <referenceContainer name="after.body.start">
        <block class="Magento\Catalog\Block\Product\View" name="product_custom" template="Magento_Catalog::product/view/product_custom.phtml" before="-"/>
        <block class="Smartwave\Porto\Block\Template" name="product_view_config" after="-" template="Magento_Catalog::product/view/config.phtml"/>
    </referenceContainer>
    <referenceContainer name="columns.top">
        <block class="Magento\Catalog\Block\Product\View" name="prev_next_products" template="Magento_Catalog::product/view/prev_next.phtml" before="-"/>
    </referenceContainer>
    <move element="prev_next_products" destination="product.info.main" before="-"/>
    <move element="page.main.title" destination="product.info.main" before="-"/>
    <referenceContainer name="product.info.social">
        <block class="Smartwave\Porto\Block\Template" name="product_view_addthis_links" after="-" template="Magento_Catalog::product/view/addthis.phtml"/>
    </referenceContainer>
    <referenceContainer name="content">
        <block class="Smartwave\Porto\Block\RickSnippet" name="rich_snippet" template="Magento_Catalog::product/view/rich_snippet.phtml" before="-"/>
        <block class="Smartwave\Porto\Block\Template" name="product_view_main_custom_block" before="product.info.main" template="Magento_Catalog::product/view/main_custom_block.phtml"/>
        <block class="Smartwave\Porto\Block\Template" name="product_view_main_custom_block2" after="-" template="Magento_Catalog::product/view/main_custom_block2.phtml"/>
    </referenceContainer>
    <move element="product_view_main_custom_block2" destination="product.info.main" after="product.info.overview"/>
    <var name="gallery">
       <var name="allowfullscreen">false</var>
    </var>    

</body>

Best Answer

Give this a try:

Before changes:Before changes

For remove Description Tab and adding description below short description use below code in catalog_product_view.xml in your theme with location app/design/frontend/Namespace/Theme/Magento_Catalog/layout

<referenceContainer name="product.info.main">
   <referenceBlock name="product.info.description" remove="true"/>
   <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.description.custom" template="product/view/attribute.phtml" group="detailed_info">
        <arguments>
            <argument name="at_call" xsi:type="string">getDescription</argument>
            <argument name="at_code" xsi:type="string">description</argument>
            <argument name="css_class" xsi:type="string">description</argument>
            <argument name="at_label" xsi:type="string">none</argument>
            <argument name="title" translate="true" xsi:type="string">Details</argument>
        </arguments>
    </block>
</referenceContainer>

After changes: After Making changes

Edit: I have correct the file path and adding whole catalog_product_view.xml

<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>

   <referenceContainer name="product.info.main">
       <referenceBlock name="product.info.description" remove="true"/>
       <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.description.custom" template="product/view/attribute.phtml" group="detailed_info">
                <arguments>
                    <argument name="at_call" xsi:type="string">getDescription</argument>
                    <argument name="at_code" xsi:type="string">description</argument>
                    <argument name="css_class" xsi:type="string">description</argument>
                    <argument name="at_label" xsi:type="string">none</argument>
                    <argument name="title" translate="true" xsi:type="string">Details</argument>
                </arguments>
            </block>
    </referenceContainer> 
</body>

Related Topic