27

I'm trying to disable the Magento 2 product reviews feature. I tried Disabling the Module at the Magento 2 admin Stores\Advanced\Advanced\Magento_Review but the reviews tab on each product is still there. Is there any way to disable it? I know for sure that we could disable it in Magento 1.

0

11 Answers 11

0

Use command line option instead:

php bin/magento module:disable --clear-static-content Magento_Review

If you want to flush the cache:

php bin/magento cache:flush

(Run it from root of your Magento 2 dir)

3
  • 18
    Now it's not possible in M2.2. It has too many dependencies.
    – Anthony
    Oct 13, 2017 at 14:57
  • 9
    Cannot disable Magento_Review because modules depend on many modules core. Nov 3, 2017 at 7:38
  • This is not possible as Review module have alot of dependencies in M2. Sep 24, 2019 at 11:14
57

Disabling the module on command line resolves in errors on different places. A better idea is to hide it with XML. Just create a child theme (if you don't have one already) like this:

How to create a Child Theme in Magento 2

and then inside your child theme create:

app/design/frontend/company_name/theme_name/Magento_Theme/layout/default.xml

and add this:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="reviews.tab" remove="true" />
        <referenceBlock name="product.review.form" remove="true" />
        <referenceBlock name="product.info.review" remove="true" />
    </body>
</page>
9
  • Remember that all reviews are in review page in customer tab (disable too). Work great in 2.1.7. Work the same when added only on product page layout.
    – Patryk
    Aug 9, 2017 at 9:41
  • Exactly what I needed!
    – vector
    Nov 9, 2017 at 14:02
  • 1
    to expand on @Patryk Padus post : <!-- Remove My Product Reviews--> <referenceBlock name="customer-account-navigation-product-reviews-link" remove="true"/> in Magento_Customer/layout/customer_account.xml
    – fogx
    Mar 28, 2018 at 11:32
  • This should be the correct answer. We should never disable the module Magento_Review. so many other modules depend on it. Apr 2, 2018 at 21:26
  • 2
    Works well in magento 2.3.1
    – electroid
    Apr 30, 2019 at 18:30
27

In Magento 2.0.2 you will get an error if you try what @MagePsycho suggested. You still can disable the module output by changing its status in the Advanced-Settings of Magento 2.

Shops > Configuration > Advanced > Advanced and search for "Review".

You might wanna flush the cache afterwards.

3
  • 3
    This is the way to go. Reviews module is marked as a dependency by other core modules (such as Customer) and cannot be disabled.
    – Mir
    Jul 1, 2016 at 13:16
  • from magento 2.2 section Shops > Configuration > Advanced > Advanced is removed, take Mike's answer as accepted.
    – LucScu
    Dec 29, 2017 at 12:04
  • 1
    But there is no advanced tab in Magento 2.2.2
    – D Singh
    May 17, 2018 at 4:36
18

In Magento 2.3 Commerce at least, you can disable Reviews in admin at Stores > Configuration > Catalog > Product Reviews enter image description here

2
  • 1
    It works also for open source version May 3, 2020 at 10:29
  • This should be the accepted answer. Works for both for Commerce and Open Source. No need to remove with XML or disabling the module from CLI.
    – puntable
    Jan 6, 2023 at 13:50
8

In Magento 2.1 , disabling the ouput as @Max suggested, will cause a troublesome popin in the product view edit.

enter image description here

Not very cool. It is caused by an Ajax Request, that finish in 503. And you will notice that there is sill a "Product Reviews" tab. It worked on 2.0 because the admin was still rendered trhough blocks. Now, it's done with UiComponent.

The "Product Review Tab" is added trough the adminhtml/di.xml of Magento_Review

  <virtualType name="Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Pool">
        <arguments>
            <argument name="modifiers" xsi:type="array">
                <item name="review" xsi:type="array">
                    <item name="class" xsi:type="string">Magento\Review\Ui\DataProvider\Product\Form\Modifier\Review</item>
                    <item name="sortOrder" xsi:type="number">20</item>
                </item>
            </argument>
        </arguments>
    </virtualType>

There is no way - or at least did not find how - to remove an argument. So we have to rewrite it, one way or another.

First i thought of doing a plugin on Magento\Review\Ui\DataProvider\Product\Form\Modifier\Review. But digging through core code make me discover a Dummy.php class. So in a custom module, create a adminhtml/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <virtualType name="Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Pool">
        <arguments>
            <argument name="modifiers" xsi:type="array">
                <item name="review" xsi:type="array">
                    <item name="class" xsi:type="string">Magento\Ui\DataProvider\Modifier\Dummy</item>
                </item>
            </argument>
        </arguments>
    </virtualType>
</config>

And don't forget to add <sequence><Magento_Review/> in your module.xml. Because XML are merged in a precise order. It has to be AFTER Magento_Review

And please note: Disabling Ouput is NOT disabling the Module, as the title of this thread is mentionning. It will only hide it:

  1. controllers will still be active. If you do a post on the proper action, the controller will still work, and you will even have a "success" message on the frontend.

  2. you will still find menus in admin, in "Report"

  3. every model logic, injection, observers will still apply.

Anyway, from my point of view, it still the best solution. Because forcing the disable of the module with module:disable -f seems a bit harsh...

1
  • Very interesting - seems like the Magento Devs need to flat out more things. Very good catch!
    – Max
    Dec 2, 2016 at 11:52
8

create:

app/design/frontend/company_name/theme_name/Magento_Theme/layout/default.xml

and add this:

<?xml version="1.0"?>
<page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
      ...
      ...
         <referenceBlock name="reviews.tab" remove="true" />
         <referenceBlock name="customer-account-navigation-product-reviews-link" remove="true" />
         <referenceBlock name="customer_account_dashboard_info1" remove="true" />
         <referenceBlock name="review_customer_list" remove="true" />
         <referenceBlock name="customers_review" remove="true" />
         <referenceBlock name="product.review.form" remove="true" />
         <referenceBlock name="review_view" remove="true" />
         <referenceBlock name="product.info.product_additional_data" remove="true" />

      ...
      ...
 </body>
</page>
2
  • Thank you, this can also be used in a single product under Layout Update XML to remove reviews for a specific item.
    – dawhoo
    Oct 10, 2018 at 17:24
  • It appears at least a link to the then non-existing review form still appears on the product pages. It can be hidden with CSS by hiding .product-reviews-summary, but perhaps there’s another rule that can be added to default.xml to actually remove it?
    – ACJ
    Aug 1, 2019 at 13:06
5

In Magento 2.2, you should just disable it in app/etc/config.php

'Magento_Review' => 0,
2
  • 1
    Doing this does not check for module dependencies and may result in unexpected behavior. Feb 9, 2018 at 14:07
  • Yes, It's working in Magento 2.2.2
    – D Singh
    May 17, 2018 at 5:00
3

php bin/magento module:disable -f Magento_Review to disable a module on which other modules rely on. It has to be done first in test environment so that any break in functionality is noticed.

2

Shops > Configuration > Advanced > Advanced and search for "Review"

or else

app/etc/config.php 'Magento_Review' => 0,

2

In Magento 2.2.5 at least, simply disabling module output through app/etc/config.php seems to work wonders:

'system' => [
    'default' => [
        'advanced' => [
            'modules_disable_output' => [
                'Magento_Review' => '1',
                'Magento_Newsletter' => '1',
            ],
        ],
        // … other config
    ],
],

This removes related module output (forms, messages) from store fronts as well as the admin interface.

0

Just a heads up that in Magento 2.3.0 the situation is improved (as in no errors are shown on the frontend when not installing module-review), however DI compilation still fails as Magento\Review\Block\Adminhtml\Grid is being referenced in Magento\Customer\Block\Adminhtml\Edit\Tab\1Reviews.

Your best best is still to disable module output or disable the module completely (but still have the code autoloaded).

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.