Is there a function/callback/event handler (sorry, not sure what the right term is) that allows me to run some code after I click “next” (button highlighted below) on the product page?
More specifically, I’ve been trying to add reviews to my product page and I’ve followed the tutorial (https://support.wix.com/en/article/corvid-tutorial-adding-ratings-and-reviews-to-a-wix-stores-site).
Everyone works fine except that after I click “next” on the product page, I still see the reviews for the previous product. I would like for the reviews to get refreshed after I go to the next product.
The basic code is below. I would like to call the same thing as within the “$w.onReady” after I click “next” on the product page, so that I get the reviews for the next product.
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();
}