-
Notifications
You must be signed in to change notification settings - Fork 38
Show specific products in collection? #13
Comments
I'm also looking at how to accomplish this. I'm trying to add Sanity data to a collections page but it seems like Shopify is queried to get the products in a collection so I'm not sure how to combine the Sanity products with the Shopify ones. I'm new to Sanity but I'm thinking perhaps a type of reference to the products is needed on the Sanity collections? Any advice is appreciated! |
I solved my issue with a Sanity query in a child component that uses the Shopify products ID to get the Sanity product. |
Do you mind sharing your code snippet? |
That sounds like a more robust approach, I was concerned that changing the Sanity setup may not work well with Sanity Connect so I chose to do it in the frontend. I'm not sure if this is a good approach but there was already a component to display the specific product details so I just added a Sanity query in like this (I've removed some of the unnecessary code):
This is my first Sanity/Hydrogen project and I have very little React experience so any advice is welcome! |
Got it. I just try to decouple my frontend code with CMS as much as possible. While in the CMS, I use Shopify as ground truth when it relates to product. But I mainly use Sanity for other content I needed for the website. I actually both added my custom schemas and modified the files provided by the template a lot for the purpose. |
Interesting, thanks for the insight. I hope as time goes on there are more resources online for this particular setup as I look forward to working with it further. |
Sanity sync Shopify collections, but it only provides meta data like GID, ID etc
Is there a way we can get the array/lists of products contained in the collection?
Any help would be really appreciated!
The text was updated successfully, but these errors were encountered: