Callback when switching to next product

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();
}

I managed to solve it by following the method described in https://www.wix.com/corvid/forum/community-discussion/trigger-prev-next-buttons-in-product-page

Code below:

import wixData from 'wix-data';
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';

let product;

$w.onReady(getProductAndInitReviews);

async function getProductAndInitReviews() {
    product = await $w('#productPage1').getProduct();
    initReviews();
}

wixLocation.onChange( (location) => {   getProductAndInitReviews(); });