Anchor to section titled 'undefined'

subscriptionDraftLineAdd
mutation

Requires write_own_subscription_contracts access scope. Also: The user must have manage_orders_information permission.

Adds a subscription line to a subscription draft.


Anchor to draftId
draftId
required

The gid of the Subscription Contract draft to add a subscription line to.

The properties of the new Subscription Line.


Was this section helpful?

The Subscription Contract draft object.

The added Subscription Line.

The list of errors that occurred from executing the mutation.


Was this section helpful?
Hide code
Mutation reference
Copy
mutation subscriptionDraftLineAdd($draftId: ID!, $input: SubscriptionLineInput!) {
  subscriptionDraftLineAdd(draftId: $draftId, input: $input) {
    draft {
      # SubscriptionDraft fields
    }
    lineAdded {
      # SubscriptionLine fields
    }
    userErrors {
      field
      message
    }
  }
}
Hide code
Input
Copy
{
  "draftId": "gid://shopify/<objectName>/10079785100",
  "input": {
    "currentPrice": "29.99",
    "customAttributes": [
      {
        "key": "<your-key>",
        "value": "<your-value>"
      }
    ],
    "pricingPolicy": {
      "basePrice": "29.99",
      "cycleDiscounts": [
        {
          "adjustmentType": "FIXED_AMOUNT",
          "adjustmentValue": {
            "fixedValue": "29.99",
            "percentage": 1.1
          },
          "afterCycle": 1,
          "computedPrice": "29.99"
        }
      ]
    },
    "productVariantId": "gid://shopify/<objectName>/10079785100",
    "quantity": 1,
    "sellingPlanId": "gid://shopify/<objectName>/10079785100",
    "sellingPlanName": "<your-sellingPlanName>"
  }
}
input SubscriptionLineInput {
  currentPrice: Decimal!
  customAttributes: [AttributeInput!]
  pricingPolicy: SubscriptionPricingPolicyInput
  productVariantId: ID!
  quantity: Int!
  sellingPlanId: ID
  sellingPlanName: String
}

input AttributeInput {
  key: String!
  value: String!
}

input SubscriptionPricingPolicyInput {
  basePrice: Decimal!
  cycleDiscounts: [SubscriptionPricingPolicyCycleDiscountsInput!]!
}