Add Item

Use the addItem mutation to add new items to the cart.

Mutation

addItem(input: AddToCartInput!): Cart!

AddToCartInput

ArgumentTypeDescription
cartIdID!The id of the cart you are adding items to
idID!The id of the item you are adding
nameStringGive items a name
descriptionStringGive items a description
typeCartItemTypeSKU (default), TAX, or SHIPPING
images[String]Any URLs to images for the item
priceInt!The item price in cents
quantityIntQuantity of items to add (default: 1)
metadataJsonCustom meta object for the cart

Example

mutation {
  addItem(
    input: {
      cartId: "ck5r8d5b500003f5o2aif0v2b"
      id: "5e3293a3462051"
      name: "Full Logo Tee"
      description: "Purple Triblend / L"
      price: 2000
      quantity: 10
    }
  ) {
    id
    totalItems
    subTotal {
      formatted
    }
    items {
      id
      name
      quantity
    }
  }
}