Magento 2 Layout – Move Product Page Review Section to Bottom

layoutmagento2product-pagereview

I need to move/rearrange Reviews from tabs of product page to bottom of page. Here is how I updated my theme file's default.xml

<referenceBlock name="reviews.tab" remove="true" />    <!-- Removed tab  -->

        <referenceContainer name="content">
        <container name="new_space"  htmlTag="div" htmlClass="container"  after="-">  <!-- New Container to display at bottom of page -->

This code works well and placed reviews at bottom of page but Home page of site goes blank and error log display below errors:

PHP Fatal error: Uncaught Error: Call to a member function getId() on null in /chroot/home/londonwa/londonwala.in/html/vendor/magento/module-review/Block/Product/View.php:131

My issue same issue like: How to Exclude Magento Review tab from tabs and show at bottom but thats in magento 1.x version.

Best Answer

Magento2, have layout tag <move> by which you move a block reference area to another area.

Please add this code at catalog_product_view.xml app/design/frontend/[VendorName]/[ThemeName]/Magento_Catalog/layout

<?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>
        <!-- add this code -->
         <move element="reviews.tab" destination="content" after="-"/>
    <!-- end -->
    </body>
</page>
Related Topic