WIX Stores (wix code) collections question

We are doing an ecom ising wix code now
Just wanted to ask something
The Stores Database does not provide the information on what product is on what collection.
Shouldn’t there be a column with the category that that product has? Or do we miss something?
Thank you

The collections is connected to the products through the reference between them, otherwise if you can’t make that work I should do my own Category Data Collection and add the products into that you need. I am making an e-commerce solution completely in Wix Code without anything from Wix Stores but it is a huge project but fun one :slight_smile:

Hey Olya,

There is a link between them, but there is no visible column which identifies it when you look into the database.

You can filter products by collection like this:

$w("#yourProductsDataset").setFilter( wixData.filter().hasSome("collections.id", [list,of,category,ids,you,look,for]) );

You can get the filtered products returned by the function like so.

import wixData from 'wix-data';

wixData.query("Stores/Products").hasSome("collections.id", [list,of,category,ids,you,look,for]) ).find().then( (results)=>{
     let items = results.items;
} );
 

If “Stores/Products” doesn’t work, check the name of your Wix Stores collection.

But what if you have a Product page before your nose, and you want to retrieve it´s collection.id?