Shopify Functions Product Discount API - get the collection ids of a product

Shopify Functions Product Discount API - get the collection ids of a product

ohadsc
Shopify Partner
16 0 2

Hey all!

 

Ohad here, from Zoorix. Maybe you can help us here 🙂

 

We are wondering if there is a way to find the collection ids of a product using the Shopify Functions Product Discount API - https://shopify.dev/docs/api/functions/reference/product-discounts/graphql/common-objects/product

 

Cheers!

Ohad

Want to sell more?
Check Zoorix
Replies 2 (2)

ohadsc
Shopify Partner
16 0 2

To give more context, we are trying to implement the Mix & Match bundle using the Shopify Functions Product Discount API or the CartTransform API, and on both APIs, we are not able to understand how to know if a product is part of a collection that is eligible for a discount. Here is the Input of the CartTransform API - https://shopify.dev/docs/api/functions/reference/cart-transform/graphql/common-objects/product

We understand that it's not possible to receive all the collection ids due to performance considerations, and that's why the inAnyCollection comes to help. The issue here is that the inAnyCollection is part of the contract and between the app and Shopify, runs on the Shopify end, and we don't have access there to the offers that are defined on the app backend. 

I hope that makes sense, and let me know if there's any additional input that can help on my end. 

 

Cheers, 

Ohad

Want to sell more?
Check Zoorix
ricardotiki
Shopify Partner
1 0 0

Hello @ohadsc !

Your question got me in the right direction to achieve this for a Discount Function. Maybe it can be done in your scenario too. I know this is an old question, but maybe it can help others that get here through search engines.

 

My goal was to apply a discount function in specific product collections and I did it by setting a variable for the input query. This is how it is done https://shopify.dev/docs/apps/functions/input-output/variables-queries#step-3-use-the-metafield-as-i...

Looks like it would work for Cart Transform API too. Hope it helps somebody.