Updates one or more merchandise lines on a cart.


Anchor to cartId
cartId
required

The ID of the cart.

The merchandise lines to update.

The input must not contain more than 250 values.


Was this section helpful?

The updated cart.

The list of errors that occurred from executing the mutation.

A list of warnings that occurred during the mutation.


Was this section helpful?
Hide code
Mutation reference
Copy
mutation cartLinesUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!) {
  cartLinesUpdate(cartId: $cartId, lines: $lines) {
    cart {
      # Cart fields
    }
    userErrors {
      field
      message
    }
    warnings {
      # CartWarning fields
    }
  }
}
Hide code
Input
Copy
{
  "cartId": "gid://shopify/<objectName>/10079785100",
  "lines": [
    {
      "attributes": [
        {
          "key": "<your-key>",
          "value": "<your-value>"
        }
      ],
      "id": "gid://shopify/<objectName>/10079785100",
      "merchandiseId": "gid://shopify/<objectName>/10079785100",
      "quantity": 1,
      "sellingPlanId": "gid://shopify/<objectName>/10079785100"
    }
  ]
}
input CartLineUpdateInput {
  attributes: [AttributeInput!]
  id: ID!
  merchandiseId: ID
  quantity: Int
  sellingPlanId: ID
}

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