Update Item

Use the updateItem mutation to update any existing items.

Mutation

updateItem(input: UpdateCartItemInput!): Cart!

ArgumentsType
inputUpdateCartItemInput!

The updateItem mutation will always return the updated Cart object.

UpdateCartItemInput!

You can update items in the cart at any time.

ArgumentTypeDescription
cartIdID!The id of the cart you the item belongs to
idID!The id of the item you are updating
nameStringSet a new item name
descriptionStringSet a new item description
typeCartItemTypeSKU, TAX, SHIPPING
images[String]Update any image URLs
priceIntSet a new unit price
quantityIntSet a new quantity
metadataJsonCustom meta object

If no item exists with the id provided, a BAD_USER_INPUT error will be returned.

Example

mutation {
  updateItem(
    input: {
      cartId: "ck5r8d5b500003f5o2aif0v2b"
      id: "5e3293a3462051"
      quantity: 2
      metadata: { engraving: "GraphQL" }
    }
  ) {
    id
    isEmpty
    abandoned
    totalItems
    totalUniqueItems
    subTotal {
      formatted
    }
    metadata
  }
}
{
  "data": {
    "updateItem": {
      "id": "ck5r8d5b500003f5o2aif0v2b",
      "isEmpty": false,
      "abandoned": false,
      "totalItems": 2,
      "totalUniqueItems": 1,
      "subTotal": {
        "formatted": "$40.00"
      },
      "metadata": {
        "engraving": "GraphQL"
      }
    }
  }
}