Skip to main content
PUT
/
checkout
Update checkout data
curl --request PUT \
  --url {protocol}://{host}/wp-json/cocart/preview/checkout \
  --header 'Content-Type: application/json' \
  --data '
{
  "billing_address": {
    "first_name": "<string>",
    "last_name": "<string>",
    "company": "<string>",
    "address_1": "<string>",
    "address_2": "<string>",
    "city": "<string>",
    "state": "<string>",
    "postcode": "<string>",
    "country": "<string>",
    "phone": "<string>",
    "email": "jsmith@example.com"
  },
  "shipping_address": {
    "first_name": "<string>",
    "last_name": "<string>",
    "company": "<string>",
    "address_1": "<string>",
    "address_2": "<string>",
    "city": "<string>",
    "state": "<string>",
    "postcode": "<string>",
    "country": "<string>"
  },
  "payment_method": "<string>",
  "shipping_method": "<string>",
  "currency": "EUR"
}
'
{ "cart_key": "abc123def456", "cart_hash": "d41d8cd98f00b204e9800998ecf8427e", "currency": { "code": "USD", "symbol": "$", "base_currency": "USD", "exchange_rate": 1 }, "customer_id": 123, "billing_address": { "first_name": "John", "last_name": "Doe", "email": "john@example.com", "phone": "+1234567890", "address_1": "123 Main St", "address_2": "Apt 4B", "city": "Anytown", "state": "CA", "postcode": "12345", "country": "US", "company": "" }, "shipping_address": { "first_name": "John", "last_name": "Doe", "address_1": "123 Main St", "address_2": "Apt 4B", "city": "Anytown", "state": "CA", "postcode": "12345", "country": "US", "company": "" }, "cart_contents": { "c4ca4238a0b923820dcc509a6f75849b": { "key": "c4ca4238a0b923820dcc509a6f75849b", "product_id": 456, "variation_id": 0, "quantity": 2, "product_name": "Premium T-Shirt", "product_title": "Premium T-Shirt", "product_price": "$19.99", "line_total": "39.98", "line_subtotal": "39.98" } }, "cart_totals": { "subtotal": "39.98", "subtotal_tax": "0.00", "shipping_total": "5.00", "shipping_tax": "0.00", "discount_total": "0.00", "discount_tax": "0.00", "cart_contents_total": "39.98", "cart_contents_tax": "0.00", "fee_total": "0.00", "fee_tax": "0.00", "total": "44.98", "total_tax": "0.00" }, "shipping_methods": { "flat_rate:1": { "id": "flat_rate:1", "label": "Flat Rate", "cost": "5.00", "method_id": "flat_rate", "instance_id": "1" } }, "needs_payment": true, "needs_shipping": true, "payment_method": "stripe" }
This endpoint is currently shown as a preview of what’s currently in development and is subject to change.

Overview

This endpoint updates checkout information such as billing/shipping addresses, payment method, or shipping method. Both PUT and PATCH methods are supported and function identically.

Body

application/json

Checkout data to update

billing_address
object
shipping_address
object
payment_method
string

Payment method ID

shipping_method
string

Shipping method ID

currency
string

Currency code for the order (e.g., USD, EUR, GBP). If not provided, store default will be used.

Pattern: ^[A-Z]{3}$
Example:

"EUR"

Response

Checkout data updated successfully

cart_key
string | null

Unique identifier for the cart session

cart_hash
string

MD5 hash of cart contents

currency
object

Currency information including code, symbol, and exchange rate

customer_id
integer

Customer ID, if logged in

billing_address
object
shipping_address
object
cart_contents
object

Cart contents with product details

cart_totals
object
shipping_methods
object

Available shipping methods

needs_payment
boolean

Whether the cart needs payment

needs_shipping
boolean

Whether the cart needs shipping

payment_method
string

Selected payment method