I would like to add a review form in my custom module front end page. On this page, I have displayed several selected products.

I want to display a review form in front of each product each review form on my custom page.

Please see the below attached screenshot for better understand.

enter image description here

How can I achieve these things? Make sure each product have a separate review form and it should be default Magento review form.

Edit :


     <?php echo $block->getLayout()->createBlock("Magento\Review\Block\Form")->setTemplate('Namespace_ModuleName::form.phtml')->toHtml(); ?>

Using create a block and set template method I am able to display review form. but I am getting trouble in submitting the form. because In my custom review page form action parameter is not passing the product ID.

The current review form action is like


What actually review form action (It should be like below).


Why ID is not passing in the form action. Is it a wrong method to display review form? or is there any other way to display review form?

Update :

After creating a custom block and extend my block to \Magento\Review\Block\Form(default) then I am able to see product ID in form action URL.


     <?php echo $block->getLayout()->createBlock("Namespace\ModuleName\Block\ReviewForm")->setTemplate('Namespace_ModuleName::form.phtml')->toHtml(); ?>

Now I can see separate review form for a separate product. But in console, I am getting an error like below.

Uncaught SyntaxError: Unexpected token u in JSON at position 0

Because of the above error, I am not able to submit a review for all product. can anyone help me to solve out this problem?

Any help would be appreciated!

2 Answers 2


It seems that you have not added jsLayout in argument data. Since you have created block in php file, you may have following code in your module's di.xml file.


<type name="[Vendor]\[Module]\Block\ReviewForm">
        <argument name="data" xsi:type="array">
            <item 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>

Add this code and it should work.


Can any one suggest. how to place review form in the Items Ordered (sales/order/view/order_id)

Your Answer

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

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