We are trying to fetch the associated products and variants for a SellingPlanGroup in Shopify using GraphQL. However, after updating our Shopify API version to 2024-07, our query started returning an 0 counts of the productsCount and productVariantsCount on SellingPlanGroup, even though our query works fine in Postman.
also made the changes on shopify_app.rb change the same version.
Error Message:
Field 'products' doesn't exist on type 'SellingPlanGroup' (Did you mean productsCount
?)
Variable $after is declared but not used.
Error Message:
Field 'productsCount' doesn't exist on type 'SellingPlanGroup' (Did you mean productsCount
?) Field 'productVariantsCount' doesn't exist on type 'SellingPlanGroup' (Did you mean productCount
?)
const GET_GROUP_DATA_GQL = gql`
query sellingPlanGroups($groupId: ID!) {
sellingPlanGroup(id: $groupId) {
name
merchantCode
description
options
tags {
name
category
}
productsCount {
count
}
productVariantsCount {
count
}
sellingPlans {
id
interval
billingIntervalCount
deliveryIntervalCount
pricing
pricingType
recurringPricing
recurringPricingType
afterCycle
name
description
position
options
minCycles
maxCycles
preAnchorBehavior
cutoff
anchors {
day
month
type
}
}
}
}
`
const onCompleted = useCallback(
({ sellingPlanGroup }) => {
if (sellingPlanGroup) {
dispatch({ type: 'productCount', data: sellingPlanGroup.productsCount })
dispatch({ type: 'variantCount', data: sellingPlanGroup.productVariantsCount })
.......
...
const [loadPlans, { loading: queryLoading }] = useLazyQuery(
GET_GROUP_DATA_GQL,
{
variables: { groupId: shopifySellingPlanGroupId },
onCompleted: onCompleted,
onError: onError,
}
)
Any guidance would be greatly appreciated!