Set Cart Items

Use the setItems mutation to set or overwrite all cart items.

The setItems mutation will replace all existing items.

Mutation

setItems(input: SetCartItemsInput!): Cart!

SetCartItemsInput

ArgumentTypeDescription
cartIdID!The id of the cart you are adding items to
items[SetCartItemInput!]!The items to set

Example

mutation {
  setItems(
    input: {
      cartId: "ck5r8d5b500003f5o2aif0v2b"
      items: [
        {
          id: "5e3293a3462051"
          name: "Full Logo Tee"
          price: 2000
          quantity: 10
        }
      ]
    }
  ) {
    id
    totalItems
    items {
      id
      name
    }
  }
}