> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cocartapi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Item in Cart

> Updates the quantity of a specific item in the customer's cart.



## OpenAPI

````yaml api-reference/v1/openapi-cart-v1.yaml post /item
openapi: 3.0.3
info:
  title: CoCart - Cart API v1
  version: 4.6.0
  description: API for managing shopping carts
  termsOfService: http://cocartapi.com/terms-of-conditions-polar/
  contact:
    email: support@cocartapi.com
  license:
    name: GNU General Public License v3.0
    url: http://www.gnu.org/licenses/gpl-3.0.html
servers:
  - url: '{protocol}://{host}/wp-json/cocart/v1'
    description: API v1
    variables:
      protocol:
        enum:
          - http
          - https
        default: https
      host:
        default: example-store.com
        description: Your store domain
security: []
tags:
  - name: cart
    description: Operations for managing the shopping cart
  - name: items
    description: Operations for managing cart items
  - name: coupons
    description: Operations for managing cart coupons
  - name: fees
    description: Operations for managing cart fees
  - name: shipping
    description: Operations for managing shipping methods and rates
  - name: calculate
    description: Operations for calculating cart totals
  - name: products
    description: Operations for managing products
externalDocs:
  description: Find out more about CoCart API
  url: https://docs.cocartapi.com
paths:
  /item:
    post:
      tags:
        - items
      summary: Update cart item
      description: Updates the quantity of a specific item in the customer's cart.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                cart_item_key:
                  description: Unique identifier for the item in the cart.
                  type: string
                quantity:
                  description: Quantity of this item to update to.
                  type: string
                return_cart:
                  description: Returns the whole cart to reduce API requests.
                  type: boolean
                  default: false
              required:
                - quantity
      responses:
        '200':
          description: Cart item updated successfully.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/CartItem'
                  - $ref: '#/components/schemas/Cart'
        '400':
          description: Bad request - invalid parameters.
        '404':
          description: Cart item not found.
components:
  schemas:
    CartItem:
      type: object
      properties:
        key:
          type: string
          description: Unique identifier for the item within the cart.
        product_id:
          type: integer
          description: Unique identifier for the product.
        variation_id:
          type: integer
          description: Unique identifier for the variation.
        variation:
          description: Chosen attributes (for variations).
          oneOf:
            - type: object
              additionalProperties:
                type: string
            - type: array
              items:
                type: string
        quantity:
          type: integer
          description: Quantity of this item in the cart.
        data_hash:
          type: string
          description: Hash of cart item data.
        line_tax_data:
          type: object
          description: Line tax data.
          properties:
            subtotal:
              description: Line subtotal tax data.
              type: array
              items:
                type: number
            total:
              description: Line total tax data.
              type: array
              items:
                type: number
        line_subtotal:
          type: number
          description: >-
            Line subtotal (the price of the product before coupon discounts have
            been applied).
        line_subtotal_tax:
          type: number
          description: Line subtotal tax.
        line_total:
          type: number
          description: >-
            Line total (the price of the product after coupon discounts have
            been applied).
        line_tax:
          type: number
          description: Line total tax.
        product_name:
          type: string
          description: Product name.
        product_title:
          type: string
          description: Product title.
        product_price:
          type: string
          description: Current product price.
        product_image:
          type: string
          description: Product image URL. (Returns if thumb is true)
      additionalProperties: false
    Cart:
      type: object
      description: >-
        A map of cart item keys to cart item objects. Each property key is a
        unique cart item key.
      additionalProperties:
        $ref: '#/components/schemas/CartItem'

````