Skip to main content
POST
/
cart
/
calculate
Calculate cart totals
curl --request POST \
  --url {protocol}://{host}/wp-json/cocart/v2/cart/calculate \
  --header 'Content-Type: application/json' \
  --data '{
  "return_totals": false
}'
{
  "subtotal": "<string>",
  "subtotal_tax": "<string>",
  "shipping_total": "<string>",
  "shipping_tax": "<string>",
  "shipping_taxes": [
    123
  ],
  "discount_total": "<string>",
  "discount_tax": "<string>",
  "cart_contents_total": "<string>",
  "cart_contents_tax": "<string>",
  "cart_contents_taxes": [
    123
  ],
  "fee_total": "<string>",
  "fee_tax": "<string>",
  "fee_taxes": [
    123
  ],
  "total": "<string>",
  "total_tax": "<string>"
}

Body

application/json
return_totals
boolean
default:false

Returns the cart totals once calculated.

Response

Cart totals calculated successfully.

  • Option 1
  • Option 2

Cart totals when return_totals is true.

subtotal
string

Cart subtotal.

subtotal_tax
string

Cart subtotal tax.

shipping_total
string

Shipping total.

shipping_tax
string

Shipping tax.

shipping_taxes
number[]
discount_total
string

Discount total.

discount_tax
string

Discount tax.

cart_contents_total
string

Cart contents total.

cart_contents_tax
string

Cart contents tax.

cart_contents_taxes
number[]
fee_total
string

Fee total.

fee_tax
string

Fee tax.

fee_taxes
number[]
total
string

Cart total.

total_tax
string

Total tax.

I