Need help with your APIs? I offer API discovery, governance & evangelism services. Explore services →
API Evangelist API Evangelist
Discovery
Learnings
Guidance
Toolbox
Alignment
API Evangelist LLC

WooCommerce Cart API

Manage the current shopper's cart session including items, coupons, and shipping

WooCommerce Cart API is one of 21 APIs that WooCommerce publishes on the APIs.io network, described by a machine-readable OpenAPI specification.

This API exposes 7 JSON Schema definitions.

Tagged areas include Cart. The published artifact set on APIs.io includes an OpenAPI specification, API documentation, an API reference, authentication docs, and 7 JSON Schemas.

This API exposes 13 operations across 10 paths, and defines 11 schemas. It is described by OpenAPI 3.1.0, at version v3.

Requests are made against a single base URL, https://example.com/wp-json/wc/v3.

13 operations 10 paths 11 schemas 2 DELETE3 GET7 POST1 PUT

Metadata

The identity and technical contract details declared by the specification.

Specification
OpenAPI 3.1.0
API Version
v3
Base URL
https://example.com/wp-json/wc/v3
Authentication
HTTP Basic
Terms of Service
Resource Areas
1

Authentication & Security 1

WooCommerce Cart API declares 1 security scheme for authenticating requests. It accepts HTTP basic authentication (basicAuth). By default, every request must be authenticated.

  • basicAuth — HTTP Basic Auth using the WooCommerce Consumer Key as the username and Consumer Secret as the password over HTTPS. Over plain HTTP use OAuth 1.0a one-legged au…

Paths & Operations 13

Across 10 paths, the API surfaces 13 operations — 2 DELETE, 3 GET, 7 POST, 1 PUT. Each is listed below with its method, path, parameters, and response codes.

Cart 13

Manage the current shopper's cart session including items, coupons, and shipping

GET
/cart
WooCommerce Get the Current Cart
getCart → 200
POST
/cart/add-item
WooCommerce Add an Item to the Cart
addCartItem 1 param body → 200400
POST
/cart/remove-item
WooCommerce Remove an Item from the Cart
removeCartItem 1 param body → 200400
POST
/cart/update-item
WooCommerce Update a Cart Item Quantity
updateCartItem 1 param body → 200400
POST
/cart/apply-coupon
WooCommerce Apply a Coupon to the Cart
applyCartCoupon 1 param body → 200400
POST
/cart/remove-coupon
WooCommerce Remove a Coupon from the Cart
removeCartCoupon 1 param body → 200400
POST
/cart/update-customer
WooCommerce Update Cart Customer Data
updateCartCustomer 1 param body → 200400
POST
/cart/select-shipping-rate
WooCommerce Select a Shipping Rate for the Cart
selectCartShippingRate 1 param body → 200400
GET
/cart/items
WooCommerce List Cart Items
listCartItems → 200
DELETE
/cart/items
WooCommerce Clear All Cart Items
clearCartItems 1 param → 200
GET
/cart/items/{key}
WooCommerce Get a Cart Item
getCartItem 1 param → 200404
PUT
/cart/items/{key}
WooCommerce Update a Cart Item by Key
updateCartItemByKey 2 params body → 200400404
DELETE
/cart/items/{key}
WooCommerce Delete a Cart Item by Key
deleteCartItem 2 params → 200404

Schemas 11

The contract defines 11 schemas that model the data the API accepts and returns. The most detailed are StoreProduct (23 properties), Cart (14 properties), CartItem (11 properties), StoreAddress (11 properties). Each schema is shown below with its type and property counts.

CartTotals
object
Cart financial totals including subtotal, taxes, shipping, and grand total.
11 properties
StoreProduct
object
A store product returned by the public Store API.
23 properties
StoreProductPrice
object
Formatted price information for a product or variation.
10 properties
AddCartItemInput
object
Input for adding an item to the cart.
5 properties 2 required
StoreAddress
object
A customer billing or shipping address in the Store API context.
11 properties
CartShippingRate
object
A shipping rate option available for the cart.
5 properties
StoreProductImage
object
Product image with thumbnail variants.
7 properties
CartCustomerInput
object
Customer address data for cart shipping/tax calculation.
2 properties
Error
object
Error response returned when a request fails.
3 properties
CartItem
object
A product item in the cart.
11 properties
Cart
object
The current customer's cart state.
14 properties

Specification

The full machine-readable OpenAPI contract behind this narrative.

Source

woocommerce-cart-api-openapi.yml Raw ↑

Other APIs WooCommerce publishes across the network.

WooCommerce Webhook Events
WooCommerce GraphQL API
WooCommerce Checkout API
WooCommerce Coupons API
WooCommerce Customers API
WooCommerce Order Notes API
WooCommerce Order Refunds API
WooCommerce Orders API
WooCommerce Payment Gateways API
WooCommerce Product Attributes API
WooCommerce Product Categories API
WooCommerce Product Reviews API