> ## 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.

# Get Cart Totals

> Get the carts totals.

<Warning>
  This endpoint will be deprecated in the future. Recommend getting the totals from the main **cart** endpoint.
</Warning>


## OpenAPI

````yaml api-reference/v2/openapi-v2-stable.yaml get /cart/totals
openapi: 3.0.3
info:
  title: CoCart - Cart API v2
  version: 4.6.0
  description: >
    CoCart REST API v2 for managing shopping carts, products, and store
    functionality.

    Compared to API v1, this version provides enhanced endpoints for cart
    operations, product management,

    and administrative functions with improved response structures and better
    error handling.
  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/v2'
    description: API v2
    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: cart-items
    description: Operations for managing cart items
  - name: cart-calculate
    description: Operations for calculating cart totals
  - name: products
    description: Operations for browsing and retrieving product information
  - name: product-attributes
    description: Operations for retrieving product attributes and attribute terms
  - name: product-categories
    description: Operations for browsing and filtering product categories
  - name: product-tags
    description: Operations for browsing and filtering product tags
  - name: product-reviews
    description: Operations for retrieving product reviews and ratings
  - name: product-variations
    description: Operations for retrieving variable product variations
  - name: admin-sessions
    description: Administrative operations for managing cart sessions
  - name: authentication
    description: Operations for user authentication
  - name: store
    description: Operations for retrieving store information and configuration
externalDocs:
  description: Find out more about CoCart API
  url: https://docs.cocartapi.com
paths:
  /cart/totals:
    get:
      tags:
        - cart-calculate
      summary: Get cart totals
      description: >
        Retrieves the cart totals including subtotal, taxes, shipping, and
        discounts.
      parameters:
        - name: html
          in: query
          description: Returns the totals pre-formatted.
          schema:
            type: boolean
            default: false
          required: false
      responses:
        '200':
          description: Cart totals retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TotalsResponse'
              example:
                subtotal: '116.00'
                subtotal_tax: '11.60'
                shipping_total: '10.00'
                shipping_tax: '1.00'
                shipping_taxes:
                  - 1
                discount_total: '23.20'
                discount_tax: '0.00'
                cart_contents_total: '92.80'
                cart_contents_tax: '11.10'
                cart_contents_taxes:
                  - 11.1
                fee_total: '5.00'
                fee_tax: '0.50'
                fee_taxes:
                  - 0.5
                total: '119.40'
                total_tax: '13.60'
        '400':
          description: Bad request - invalid parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: cocart_invalid_parameter
                message: Invalid parameter provided.
                data:
                  status: 400
components:
  schemas:
    TotalsResponse:
      allOf:
        - $ref: '#/components/schemas/CartTotals'
    ErrorResponse:
      type: object
      description: Standard error response structure.
      properties:
        code:
          type: string
          description: Machine-readable error code.
          example: cocart_invalid_parameter
        message:
          type: string
          description: Human-readable error message.
          example: Invalid parameter provided.
        data:
          type: object
          description: Additional error data.
          properties:
            status:
              type: integer
              description: HTTP status code.
              example: 400
            params:
              type: object
              description: Parameter-specific error details.
              additionalProperties: true
          additionalProperties: true
    CartTotals:
      type: object
      properties:
        subtotal:
          type: string
          description: Cart subtotal.
        subtotal_tax:
          type: string
          description: Cart subtotal tax.
        shipping_total:
          type: string
          description: Shipping total.
        shipping_tax:
          type: string
          description: Shipping tax.
        shipping_taxes:
          type: array
          items:
            type: number
        discount_total:
          type: string
          description: Discount total.
        discount_tax:
          type: string
          description: Discount tax.
        cart_contents_total:
          type: string
          description: Cart contents total.
        cart_contents_tax:
          type: string
          description: Cart contents tax.
        cart_contents_taxes:
          type: array
          items:
            type: number
        fee_total:
          type: string
          description: Fee total.
        fee_tax:
          type: string
          description: Fee tax.
        fee_taxes:
          type: array
          items:
            type: number
        total:
          type: string
          description: Cart total.
        total_tax:
          type: string
          description: Total tax.

````