We took a site with Wix Stores and added Ratings and Reviews functionality to it.
Site members can go to a product’s page and add a rating and a written review, and recommend the product. The Product page displays average rating and recommendation information for the product and the details of each rating.
If a visitor isn’t a site member and wants to add a review they are prompted to sign in.
To view the Example:
How we built it
The collectionsreview-stats collection
The review-stats collection has the following fields:
rating: The total stars the product received
count: The number of times the product was rated
recommended: The number of times the product was recommended
ID: The ID of the product
The reviews collection has fields that match the review information the member provides and a field that references the product in the Products collection.
Adding ratings and reviews
Members add their review in a lightbox. The lightbox has input fields for the member’s review, including the member’s details, a written review, a photo upload button, and clickable stars for their rating. There are also radio buttons that let them recommend the product.
To create the clickable stars we created two groups of stars of different colors and placed the blue stars over the gray stars. When a member hovers over a blue star, that star and all the ones to its left are shown and the review rating is set to the number star that was clicked. Soon we’ll have an element that will make this even easier.
When a member posts their review, the details of that review are saved to the reviews collection, the review statistics for the product are added or updated in the review-stats collection, and the lightbox closes.
Displaying ratings and reviews
The Product page displays the number of ratings, average rating, the percentage of raters who recommend the product, and the details of each rating. There is also a Write a Review button which opens the lightbox and passes it information about the current product.
We added the necessary elements to display the average star rating for the product, the number of reviews it received, and the percentage of people who recommend the product. The data for these elements is retrieved from the review-stats collection.