How to get and disable product reviews in Magento 2?
According to the Statista report, reviews and ratings play an important role in making purchasing decisions for 53% of US online shoppers. This makes the functionality an integral part of online stores. So let’s see how you can enable or disable the display of product reviews in Magento 2 and how you can extend default features.
Magento 2 native product reviews functionality
To enable product reviews for your Magento 2 store:
- Go to Stores > Settings > Configuration.
- Open the Catalog tab and choose the Catalog option.
- Navigate to the Product Reviews section and set Yes in the Enabled and Allow Guests to Write Reviews fields or No if you want to remove 'be the first to review this product' message on Magento 2 frontend.
- Save the changes to remove the 'be the first to review this product' in Magento 2.
Now your customers can leave their review on the products they bought.
Also, you can enable ratings to allow users to evaluate different aspects of the product and service on a five-point scale. For this:
- Go to Stores > Attributes > Rating.
- Click on the Add New Rating button.
- Enter the Default Value for each store view, configure Visibility In, Sort Order, and make the rating active by selecting the Is Active checkbox.
- Save the changes.
If customer reviews are not showing on the product pages of your Magento 2 store, make sure you've approved them. So, if Magento product reviews are not showing, do the following:
- Navigate to Marketing > User Content > Pending Reviews.
- Choose the needed review from the list and edit it, if needed.
- Change the Status to Approved or Not Approved.
- Click on the Save Review button.
These were the vanilla Magento 2 settings for product reviews, so let’s see how you can extend them with the help of Amasty extension.
Advanced Product Reviews
The module allows you to show customers’ reviews on any CMS page:
- Place the widget in the Main content area, Main Content Bottom/Top, Sidebar Main, or in any place that suits your design layout;
- Automatically send emails to your customers with coupon codes and stimulate them to write a review on their recent purchases;
- Help your customers’ leave a review faster, add the pros and cons blocks to the form, the “I recommend this product” checkbox, the Was this review helpful voting section;
- Influence users’ shopping decisions letting visitors filter the reviews to find the relevant, show the product reviews statistics section with the all-the-rating summary, structured and clickable;
- Save admins time on managing the pending reviews. Make them notified via email and let them answer right from the backend grid.
How to disable product reviews in Magento 2?
To disable Magento 2 product reviews, go to Stores > Settings > Configuration > Catalog, open the Product Reviews section, and set the Enabled field to No. Don’t forget to save changes, clear the cache, and check the result on the frontend. After you do these steps, users won’t be allowed to write reviews.
How to show reviews on Magento 2 product page?
To show reviews on the Magento 2 product page, go to Stores > Settings > Configuration. Open the Catalog tab and choose the Catalog option. Navigate to the Product Reviews section and set Yes in the Enabled and Allow Guests to Write Reviews fields. Save the changes and refresh the cache. After this, you can get product reviews in your Magento 2.
What to do if Magento 2 product reviews are not showing?
If Magento 2 product reviews are not showing on the front end, you need to make sure you've approved them. By default, all the reviews you get require moderation by the admin. For this, go to Marketing > User Content > Pending Reviews. Choose the needed review from the list and change the Status to Approved. Save review.
How can I get the product review collection in Magento 2?
In Magento 2, you can easily retrieve the product review collection using the
\Magento\Review\Model\ResourceModel\Review\CollectionFactory class. First, you need to inject this class into your constructor, and then you can call the
create() method to get an instance of the review collection. Once you have the collection, you can apply filters and sorting as needed. For example, you can filter by product ID using the
addEntityFilter() method. Finally, you can call the
getData() method to retrieve the review data.