I have created review form as popup modal, And I have also removed reviews tab in product page. And I have created new section before footer which contains the collection of customer reviews which is shown in frontend, Now I need to Limit the reviews via xml, Please provide me a solution


<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceBlock name="product.info.review">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">XXX_YYY::review.phtml</argument>
            <!--To display popup and form-->
            <block class="Magento\Review\Block\Form" name="custom.review.popup" template="XXX_YYY::popup.phtml">
                <block class="Magento\Review\Block\Form" name="custom.product.review.form" as="custom.review_form" template="XXX_YYY::form.phtml">
                    <container name="product.review.form.fields.before" as="form_fields_before" label="Review Form Fields Before"/>
                        <argument name="jsLayout" xsi:type="array">
                            <item name="components" xsi:type="array">
                                <item name="review-form" xsi:type="array">
                                    <item name="component" xsi:type="string">Magento_Review/js/view/review</item>
        <!--Removes the review tab-->
        <referenceBlock name="product.info.details">
            <referenceBlock name="reviews.tab" remove="true" />
        <!--Display Customer reviews collection-->
        <referenceContainer name="product.info.additional">
            <block class="Magento\Review\Block\Product\View\ListView"  name="custom.product.section.info" template="XXX_YYY::customer-reviews.phtml"/> 

1 Answer 1


Override Magento\Review\Block\Product\View\ListView file using di.xml with below code:

 * Prepare product review list toolbar
 * @return $this
protected function _prepareLayout()
    $toolbar = $this->getLayout()->getBlock('product_review_list.toolbar');
    if ($toolbar) {
        $collection = $this->getReviewsCollection();

        $this->setChild('toolbar', $toolbar);

    return $this;

Note: all protected methods should which rquired to use should be in your class. Remove toolbar code from xml which is in Magento_Review > module > view -> frontend > layout > catalog_product_view.xml

  • Can you explain the above code
    – Jaisa
    Dec 21, 2017 at 5:30
  • I need to display only 10 reviews in product page
    – Jaisa
    Dec 21, 2017 at 5:30
  • 10 limit is default , you can remove toolbar so it will so only 10 reviews Dec 21, 2017 at 5:54
  • If I need to displaymore than 10 reviews means what would /i do
    – Jaisa
    Dec 21, 2017 at 6:21
  • use $toolbar->setLimit(15); to set limit Dec 21, 2017 at 6:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.