Retrieving collection fields from Stores/Products

I want to retrieve the collection ID’s for each product. This appears when I use the WIX REST API Curl examples “query products”.

When I use this code: async function retrieveAllItems() {
let results = await wixData.query(“myCollection”)
.limit(1000)
.find();
let allItems = results.items;
while (results.hasNext()) {
results = await results.next();
allItems = allItems.concat(results.items);
}
return allItems;
}

and then response.body = {“items” = alllitems} I cannot see that data.

I have tried
wixData.query(“Stores/Products”)
.find({
appOptions: {
includeVariants: true,
includeHiddenProducts: true
}
but this does not do it. What else do i need to do?

Lawrence

Although there is a collections field key inside the Stores/Products dataset, it is not accessible through code.

I could not understand what you need and why you need it for, if care to explain a little bit more, maybe I can help you. I have done a custom product page and I got to know some of the limitations of the Stores/Products dataset.

Hi there :wave:t2: Check out this post where we were able to find the collection IDs and then query the Products database, maybe it can help you out.

Nice, I though about using the .include() method. Thanks.