Update Cart

Use the updateCart mutation to delete a cart, and all items associated to it.

Mutation

updateCart(input: UpdateCartInput!): Cart!

ArgumentsType
inputUpdateCartInput!

The updateCart mutation will always return the updated Cart.

UpdateCartInput!

ArgumentTypeDescription
idID!The id of the Cart you want to update.
currencyCurrencyInputUpdate the cart currency.
emailStringUpdate the email associated with the cart.
notesStringLet customer save notes for the cart.
metadataJsonCustom metadata object for the cart.

If no cart item exists with the id provided, an error will be returned.

Example

mutation {
  updateCart(
    input: {
      id: "ck5r8d5b500003f5o2aif0v2b"
      currency: { code: USD }
      email: "hi@cartql.com"
      notes: "These are my order notes"
      metadata: {
        subscribeToUpdates: "hi@cartql.com"
        referredBy: "@notrab"
        acceptsMarketing: true
      }
    }
  ) {
    id
    currency {
      code
    }
    email
    notes
    metadata
  }
}
{
  "data": {
    "updateCart": {
      "id": "ck5r8d5b500003f5o2aif0v2b",
      "currency": {
        "code": "USD"
      },
      "email": "hi@cartql.com",
      "notes": "These are my order notes",
      "metadata": {
        "subscribeToUpdates": "hi@cartql.com"
        "referredBy": "@notrab"
        "acceptsMarketing": true
      }
    }
  }
}