Solved

'sellingPlanGroupCreate' doesn't exist on type 'Mutation'

Tiber
Shopify Partner
31 4 6

I am trying to create a new subscription, but am getting 'sellingPlanGroupCreate' doesn't exist on type 'Mutation'. I am using the example on Create and manage selling plans (shopify.dev)

 

 

 

 

mutation {
  sellingPlanGroupCreate(
    input: {
      name: "Subscribe and save"
      merchantCode: "subscribe-and-save"
      options: ["Delivery every"]
      position: 1
      sellingPlansToCreate: [
        {
          name: "Delivered every week"
          options: "1 Week(s)"
          position: 1
          billingPolicy: { recurring: { interval: WEEK, intervalCount: 1 } }
          deliveryPolicy: { recurring: { interval: WEEK, intervalCount: 1 } }
          pricingPolicies: [
            {
              fixed: {
                adjustmentType: PERCENTAGE
                adjustmentValue: { percentage: 15.0 }
              }
            }
          ]
        }      
      ]
    }
    resources: { productIds: ["gid://shopify/Product/6150550323354"], productVariantIds: [] }
  ) {
    sellingPlanGroup {
      id
    }
    userErrors {
      field
      message
    }
  }
}

 

 

 

 

Accepted Solution (1)
Tiber
Shopify Partner
31 4 6

This is an accepted solution.

The error was caused by not using API version 2021-01

View solution in original post

Replies 3 (3)

ewalker
Shopify Staff
30 4 7

Have you requested access to the subscriptions APIs, as documented in the tutorial here and here?

To request access to the required scopes:

  1. From your app's overview page, click App setup.
  2. In the Subscriptions section, click Request access to Subscription APIs.
  3. Provide a description about why you are applying for access.
  4. Click Request access.

I believe this is the error you would receive until your application has been granted permission.

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

Tiber
Shopify Partner
31 4 6

@ewalker 

 Hi,  Thanks for the reply.  The app has already been approved to use the Subscriptions API. Is there anything else that might be causing this error?

 

Thanks

Tiber
Shopify Partner
31 4 6

This is an accepted solution.

The error was caused by not using API version 2021-01