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

Solved
Tiber
Tourist
12 3 0

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). I have access to the subscription API for my app and have the scopes "write_products,write_customers,write_draft_orders,read_customer_payment_methods,write_own_subscription_contracts,read_own_subscription_contracts" set.

Below is the query I am trying.

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

 

 

 

0 Likes
Tiber
Tourist
12 3 0

This is an accepted solution.

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

0 Likes