< Prev | Next > Product Navigation


I’m creating a Webstore. For some of my products, I want to allow my clients to download further information on PDF format. It this specific case I want them to download a file called “TastingNotes” which is specific to each product, and might not exist for some.

  • I’ve created a new collection called “Tasting Notes”. It has a type reference field, which connects it to the product collection, and a type document field, where the PDF file is stored.

  • I’ve add a DataSet in the page for that collection.

  • I’ve added a button to the page , which I’ve connected to document field in the DataSet.

  • Since the DataSet returns all records in the collection, I’ve added the code bellow to filter the DataSet to the displayed product. If there are no results, that is no file for that project, I disable the button.

No issues and all is well. Except for, the “Prev” and “Next” navigation option on the product page. If I navigate through products by going back to “Shop Now” and then chose a specific product, there are no issues. But if I press “Prev” or “Next” the code bellow isn’t executed, and pressing the download button, shows the tasting notes for the first product shown. That is, the “onReady” function isn’t executed for every new product, but only for the first one. I haven’t found much documentation concerning the product navigation options. Can someone help me? many thanks.

// For full API documentation, including code examples, visit Velo API Reference - Wix.com
import wixData from ‘wix-data’ ;

$w.onReady( function () {

async function checkTastingNotes ( ) {
let product = await $w( ‘#productPage1’ ).getProduct();
$w( “#TastingNotesDataset” ).setFilter( wixData.filter()
.eq( “product” , product._id)
.then( () => {
let numberOfResults = $w( “#TastingNotesDataset” ).getTotalCount();
if (numberOfResults > 0 ) {
$w( “#DownloadTastingNotes” ).enable();
$w( “#DownloadTastingNotes” ).label = “Download Tasting Notes” ;
} else {
$w( “#DownloadTastingNotes” ).disable();
$w( “#DownloadTastingNotes” ).label = “No Tasting Notes Found” ;
} )
} // End async function checkTastingNotes


I’ve managed to fix it by adding:

import wixLocation from ‘wix-location’ ;

wixLocation.onChange( (location) => {

many thanks