# Gettings collections from a product

**URL:** <https://forum.wixstudio.com/t/gettings-collections-from-a-product/31813>\
**Category:** Ask the community\
**Tags:** code, question, wix-stores\
**Created:** [December 20, 2019, 12:14pm UTC](https://forum.wixstudio.com/t/gettings-collections-from-a-product/31813 "2019-12-20T12:14:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![niklasnoerregaard](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/niklasnoerregaard/32/16369_2.png) [@niklasnoerregaard](https://forum.wixstudio.com/u/niklasnoerregaard)\
**Post date:** [December 20, 2019, 12:14pm UTC](https://forum.wixstudio.com/t/gettings-collections-from-a-product/31813/1 "2019-12-20T12:14:32Z")

</div>

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 [https://support.wix.com/en/article/corvid-wix-stores-product-collection-fields](https://support.wix.com/en/article/corvid-wix-stores-product-collection-fields) (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?

---

<div class="post-metadata">

**Author:** ![niklasnoerregaard](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/niklasnoerregaard/32/16369_2.png) [@niklasnoerregaard](https://forum.wixstudio.com/u/niklasnoerregaard)\
**Post date:** [December 20, 2019, 1:17pm UTC](https://forum.wixstudio.com/t/gettings-collections-from-a-product/31813/2 "2019-12-20T13:17:46Z")

</div>

Never mind. I answered my own question when I found ‘include’ in the documentation for WixDataQuery [https://www.wix.com/corvid/reference/wix-data.WixDataQuery.html](https://www.wix.com/corvid/reference/wix-data.WixDataQuery.html)
