最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

typescript - Shopify GraphQL: Unable to Fetch Associated Products and Variants for Selling Plan Group - Stack Overflow

programmeradmin4浏览0评论

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!

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论