Reviews

I have been having issues with adding reviews to my online shop ive contacted wix but no one seems to be able to help me. Per this article https://support.wix.com/en/article/corvid-tutorial-adding-ratings-and-reviews-to-a-wix-stores-site#step-4-prepare-the-product-page im having trouble from steps 4 down i’ve included my personalization but im still having issues. Does anyone have any tweaks and fixes?

People reading your post will need more details etc to see what you’ve done so far.

If you don’t elaborate more then users will just think that you should simply follow the tutorial as it clearly states what to do.

@sailorcihan here i have updated what is see


this is the code im using to add the reviews. i want my reviews to display to the correct product screen and not appear on every screen and repeat multiple time


Here is how my screen is appearing

To resolve the issue, please remove the element id specified inside the getProduct() method and the filter method as well.
These two lines of code should look like this:
product = await $w(‘#productPage1’).getProduct();

await $w(‘#Reviews’).setFilter(wixData.filter().eq(‘productId’, product._id));

Sam’s reply will fix it for you, however why put the extra code in there in the first place?

import wixData from 'wix-data';
import wixWindow from 'wix-window';
let product; 
$w.onReady(async function () {
product = await $w('#productPage1').getProduct(); 
initReviews(); 
});
async function initReviews() {
await $w('#Reviews').setFilter(wixData.filter().eq('productId', product._id));
showReviews();
loadStatistics();
}

You only need to change parts of the code where it tells you to in the tutorial, for example like this one…

Identifiers you may need to change based on your site's elements
If you want to use this exact scenario and code in your site, you may need to modify these items to match the ones on your site:
#productPage1

Also, move your import line for Wix Storage up underneath your other imports, it shouldn’t be halfway through your code.

Although I don’t recall that tutorial having the need for the use of Wix Storage.