I have created product pages by using Wix store, and I want to add content from a dataset to each product (Dynamically), how can I filter that dataset by using the product Id or SKU?
I added a reference filed in my dataset then used this code but it’s still not working at all
import wixData from 'wix-data';
import wixLocation from 'wix-location';
$w.onReady(() => {
$w('#dataset1').onReady(async()=> {
let product = $w('#productPage1').getProduct();
await $w('#dataset1').setFilter(wixData.filter()
.eq('productId', product._id)
)
})
})
wixLocation.onChange(async (location) => {
let product = $w('#productPage1').getProduct();
await $w('#dataset1').setFilter(wixData.filter()
.eq('productId', product._id)
)
});
Thanks in advance