Gettings collections from a product

I want to create a dynamic UI on a product page based on whether or not a product belongs to a certain collection.
I can get the product on the product page via getProduct(), however, the returned StoreProduct does not contain the ‘collections’ property. I then discovered ‘wix-data’ and the ability to get an arbitrary object (according to the documentation) from any database collection based on its id. I had high hopes for this, unfortunately, it seems to return exactly the same properties as StoreProduct did.
I see the ‘collections’ property on the database collection ‘Stores/Products’ and it is also documented here (scroll to the very bottom) but I cannot seem to access it in my code.
In summary, my question is this: How do I, given a product id, access the collections it is associated with?

Never mind. I answered my own question when I found ‘include’ in the documentation for WixDataQuery

1 Like