Review submission message You submitted your review for moderation. is not showing up immediately after submitting a review. In fact, it will not show up on the product view page at all, and I must navigate to any other page for the message to render.

There seems to be some JS error that prevents fully loading the product view page. Request to get .../pub/static/frontend/Theme/default/en_US/Magento_Ui/template/messages.html isn't on the product view page, apparently due to the JS error displayed in the console. I'm guessing this is likely the issue..

console log

Looks like the object passed to run is undefined.. Where do I go debug this from here? On other pages, one of the objects passed in here is messaged with the review submission message.

  • Using \Magento\Framework\Message\ManagerInterface $messageManager ? – Jackson Feb 23 '17 at 2:21
  • we've got a similar issue on one of our m2 sites. out of interest, how/where are you adding the review form to the product tab? ie is it in magento_catalog xml or magento_review xml? – pixiemedia Feb 23 '17 at 11:56

Add in you current layout catalog_product_view.xml :

    <referenceBlock name="product.review.form">
            <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>

Hope this helps

  • works for me, thanks! :) But why do we need it? – Matej Đaković Nov 29 '17 at 11:45
  • Same question. Why can not we work it using block? – Slimshadddyyy Feb 27 '18 at 14:10
  • thanks. The real problem is that the update handles do not do their job within a custom theme for some reason. Need to investigate that – CompactCode Apr 28 '18 at 18:21
  • Its working for me also. How you track this problem. – Shekhar Suman Jun 12 '18 at 10:17

Found the solution after much fiddling. In my case, in my custom themes file;


I was declaring the tab block so I could add extra tabs to the product page;

<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.details" template="product/view/details.phtml" after="product.info.media">
..... new tabs in here

With this in place, I noticed the reviews tab would no longer load despite being set to do so in the core layout files (/app/code/Magento/Review/view/frontend/layout...), so I was manually adding it within my product.info.details block;

<block class="Magento\Review\Block\Product\Review" name="reviews.tab" template="Magento_Review::review.phtml" group="detailed_info">
                <block class="Magento\Review\Block\Form" name="product.review.form" as="review_form">
                    <container name="product.review.form.fields.before" as="form_fields_before" label="Review Form Fields Before"/>

However, this is the wrong way to go. Instead of redeclaring the whole product.info.details block in your custom theme product view layout, just reference the existing block instead. So change your call to;

<referenceBlock name="product.info.details">
.... custom tabs in here - dont manually add the reviews tab

Add whatever custom tabs you need here, and remove the direct call to the reviews tab if it is present.

Problem solved. The reviews tab and form are now present and the json error goes away - which means messages can appear on the product page again ('You submitted your review for moderation.' etc).

Hope this helps

  • The review block isn't re-declared. How did you figure out that the review block was causing the problem in your case? – musicliftsme Feb 26 '17 at 20:24
  • hi, first i disabled my theme catalog_product_view.xml which removed the problem, then i re-enabled it and switched all my customisations off at a time - and it was the review tab/form which was causing the error – pixiemedia Feb 27 '17 at 8:41
  • should be the accepted answer – simonthesorcerer Nov 29 '17 at 14:24
  • I am trying to separate customer reviews under Review tab and Review form under new Add your review tab. It works but breaks and gives same exception as you posted. Below is the code <referenceBlock name="product.review.form" remove="true" /> <referenceBlock name="product.info.details"> <block class="Magento\Review\Block\Form" name="custom.product.review.tab" group="detailed_info"> <arguments> <argument translate="true" name="title" xsi:type="string">Add Your Review</argument> </arguments> </block> </referenceBlock> How do I resolve this OR post your complete code – Slimshadddyyy Feb 27 '18 at 7:25
  • This is the best answer except I think OP may have meant to say put <referenceBlock name="reviews.tab"> in catalog_product_view.xml – Cypher909 Mar 4 '20 at 20:28

Uncaught SyntaxError: Unexpected token P in JSON at position 128

I am facing the same issue but in my site issue in Product name.

For Ex: Betallic 18"PKG HBD Glittering Birthday Confetti Foil Balloon.

product name contains (") special sign when I removed and save product error is gone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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