Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Some help with fetching sellingPlanGroups!

Some help with fetching sellingPlanGroups!

DrJulik
Tourist
7 1 3

Hey guys. We are trying to fetch sellingPlan info for our app. However, when I query the sellingPlanGroups, nothing is returned (img.1). On the other hand when I write a liquid snippet to access selling_plan_groups it displays everything correctly. I assume there's a problem with a graphql query or something. Or am I just looking in the wrong place? Any help is appreciated!

Screenshot 2021-08-26 135434.jpgScreenshot 2021-08-25 143404.jpg

Reply 1 (1)

LarryReid
Shopify Staff
87 9 22

Hi, and thanks for the question. Is it possible that one of the products is attached to a selling plan only via the variant? If so, that would explain why the count from your GraphQL query is less than the result you get from Liquid. The `sellingPlanGroupCount` on the product returns the count of selling plans directly connected to the product. Maybe you can try querying `productVariant` rather than `product`, if it fits your use case?

Let me know if you have any further questions.

To learn more visit the Shopify Help Center or the Community Blog.