Documentation is still being updated. Some content maybe unfinished.
A valid request URL is required to generate request examples{
"cart_hash": "e629fa6598d732768f7c726b4b621285",
"cart_key": "cb7a23af96a3f23af3c28a8b4b8c6d5e",
"currency": {
"currency_code": "USD",
"currency_symbol": "$",
"currency_symbol_pos": "left",
"currency_minor_unit": 2,
"currency_decimal_separator": ".",
"currency_thousand_separator": ",",
"currency_prefix": "$",
"currency_suffix": ""
},
"customer": {
"billing_address": {
"billing_first_name": "John",
"billing_last_name": "Doe",
"billing_company": "Acme Corporation",
"billing_country": "US",
"billing_address_1": "123 Main Street",
"billing_address_2": "Suite 100",
"billing_postcode": "90210",
"billing_city": "Beverly Hills",
"billing_state": "CA",
"billing_phone": "+1-555-123-4567",
"billing_email": "[email protected]"
},
"shipping_address": {
"shipping_first_name": "John",
"shipping_last_name": "Doe",
"shipping_company": "Acme Corporation",
"shipping_country": "US",
"shipping_address_1": "123 Main Street",
"shipping_address_2": "Suite 100",
"shipping_postcode": "90210",
"shipping_city": "Beverly Hills",
"shipping_state": "CA"
}
},
"items": {
"d6b3e8e5a1b0c6e4f2a3b1d8c5e6f9a2": {
"item_key": "d6b3e8e5a1b0c6e4f2a3b1d8c5e6f9a2",
"id": 145,
"name": "Wireless Bluetooth Headphones",
"title": "Wireless Bluetooth Headphones",
"price": "$18.00",
"quantity": {
"value": 2,
"min_purchase": 1,
"max_purchase": -1
},
"totals": {
"subtotal": 36,
"subtotal_tax": 3.6,
"total": 36,
"tax": 3.6
},
"slug": "wireless-bluetooth-headphones",
"meta": {
"product_type": "simple",
"sku": "WBH-001",
"dimensions": {
"length": "",
"width": "",
"height": "",
"unit": "cm"
},
"weight": "0.5",
"variation": {}
},
"backorders": "no",
"cart_item_data": {},
"featured_image": "https://example-store.com/wp-content/uploads/2024/03/headphones-blue.jpg"
},
"f3a8b2c6d5e9f1a4b7c0d3e6f9a2b5c8": {
"item_key": "f3a8b2c6d5e9f1a4b7c0d3e6f9a2b5c8",
"id": 289,
"name": "Premium Cotton T-Shirt - Large, Navy Blue",
"title": "Premium Cotton T-Shirt",
"price": "$80.00",
"quantity": {
"value": 1,
"min_purchase": 1,
"max_purchase": 100
},
"totals": {
"subtotal": 80,
"subtotal_tax": 8,
"total": 80,
"tax": 8
},
"slug": "premium-cotton-tshirt",
"meta": {
"product_type": "variation",
"sku": "PCT-LG-NB",
"dimensions": {
"length": "25",
"width": "20",
"height": "2",
"unit": "cm"
},
"weight": "0.2",
"variation": {
"attribute_pa_size": "Large",
"attribute_pa_color": "Navy Blue"
}
},
"backorders": "no",
"cart_item_data": {},
"featured_image": "https://example-store.com/wp-content/uploads/2024/03/tshirt-navy.jpg"
}
},
"item_count": 3,
"items_weight": 1.5,
"coupons": [
{
"coupon": "SUMMER20",
"label": "Summer Sale 20% Off",
"saving": "$23.20",
"saving_html": "<strong>$23.20</strong>"
}
],
"needs_payment": true,
"needs_shipping": true,
"shipping": {
"total_packages": 1,
"show_package_details": true,
"has_calculated_shipping": true,
"packages": {
"default": {
"package_name": "Shipping",
"rates": {
"flat_rate_1": {
"key": "flat_rate:1",
"method_id": "flat_rate",
"instance_id": 1,
"label": "Flat Rate",
"cost": "10.00",
"html": "Flat Rate: $10.00",
"taxes": "1.00",
"chosen_method": true
},
"free_shipping_2": {
"key": "free_shipping:2",
"method_id": "free_shipping",
"instance_id": 2,
"label": "Free Shipping",
"cost": "0.00",
"html": "Free Shipping",
"taxes": "0.00",
"chosen_method": false
}
},
"package_details": "Shipped from Main Warehouse",
"index": 0,
"chosen_method": "flat_rate:1",
"formatted_destination": "Beverly Hills, CA 90210, US"
}
}
},
"fees": [
{
"name": "Gift Wrapping",
"amount": 5,
"taxable": true,
"tax_class": "standard",
"total": 5,
"tax": 0.5
}
],
"taxes": [
{
"rate_id": 1,
"label": "Sales Tax",
"compound": false,
"tax_total": "13.10",
"shipping_tax_total": "1.00"
}
],
"totals": {
"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"
},
"removed_items": [],
"cross_sells": [
{
"id": 312,
"product_name": "Wireless Charging Pad",
"product_title": "Wireless Charging Pad",
"price": "$29.99",
"regular_price": "$39.99",
"sale_price": "$29.99",
"product_image": "https://example-store.com/wp-content/uploads/2024/03/charging-pad.jpg"
},
{
"id": 445,
"product_name": "Phone Case - Universal",
"product_title": "Phone Case - Universal",
"price": "$15.99",
"regular_price": "$15.99",
"sale_price": "",
"product_image": "https://example-store.com/wp-content/uploads/2024/03/phone-case.jpg"
}
],
"extensions": {}
}Get the full cart including all items, totals, and customer information.
curl --request GET \
--url {protocol}://{host}/wp-json/cocart/v2/cart{
"cart_hash": "e629fa6598d732768f7c726b4b621285",
"cart_key": "cb7a23af96a3f23af3c28a8b4b8c6d5e",
"currency": {
"currency_code": "USD",
"currency_symbol": "$",
"currency_symbol_pos": "left",
"currency_minor_unit": 2,
"currency_decimal_separator": ".",
"currency_thousand_separator": ",",
"currency_prefix": "$",
"currency_suffix": ""
},
"customer": {
"billing_address": {
"billing_first_name": "John",
"billing_last_name": "Doe",
"billing_company": "Acme Corporation",
"billing_country": "US",
"billing_address_1": "123 Main Street",
"billing_address_2": "Suite 100",
"billing_postcode": "90210",
"billing_city": "Beverly Hills",
"billing_state": "CA",
"billing_phone": "+1-555-123-4567",
"billing_email": "[email protected]"
},
"shipping_address": {
"shipping_first_name": "John",
"shipping_last_name": "Doe",
"shipping_company": "Acme Corporation",
"shipping_country": "US",
"shipping_address_1": "123 Main Street",
"shipping_address_2": "Suite 100",
"shipping_postcode": "90210",
"shipping_city": "Beverly Hills",
"shipping_state": "CA"
}
},
"items": {
"d6b3e8e5a1b0c6e4f2a3b1d8c5e6f9a2": {
"item_key": "d6b3e8e5a1b0c6e4f2a3b1d8c5e6f9a2",
"id": 145,
"name": "Wireless Bluetooth Headphones",
"title": "Wireless Bluetooth Headphones",
"price": "$18.00",
"quantity": {
"value": 2,
"min_purchase": 1,
"max_purchase": -1
},
"totals": {
"subtotal": 36,
"subtotal_tax": 3.6,
"total": 36,
"tax": 3.6
},
"slug": "wireless-bluetooth-headphones",
"meta": {
"product_type": "simple",
"sku": "WBH-001",
"dimensions": {
"length": "",
"width": "",
"height": "",
"unit": "cm"
},
"weight": "0.5",
"variation": {}
},
"backorders": "no",
"cart_item_data": {},
"featured_image": "https://example-store.com/wp-content/uploads/2024/03/headphones-blue.jpg"
},
"f3a8b2c6d5e9f1a4b7c0d3e6f9a2b5c8": {
"item_key": "f3a8b2c6d5e9f1a4b7c0d3e6f9a2b5c8",
"id": 289,
"name": "Premium Cotton T-Shirt - Large, Navy Blue",
"title": "Premium Cotton T-Shirt",
"price": "$80.00",
"quantity": {
"value": 1,
"min_purchase": 1,
"max_purchase": 100
},
"totals": {
"subtotal": 80,
"subtotal_tax": 8,
"total": 80,
"tax": 8
},
"slug": "premium-cotton-tshirt",
"meta": {
"product_type": "variation",
"sku": "PCT-LG-NB",
"dimensions": {
"length": "25",
"width": "20",
"height": "2",
"unit": "cm"
},
"weight": "0.2",
"variation": {
"attribute_pa_size": "Large",
"attribute_pa_color": "Navy Blue"
}
},
"backorders": "no",
"cart_item_data": {},
"featured_image": "https://example-store.com/wp-content/uploads/2024/03/tshirt-navy.jpg"
}
},
"item_count": 3,
"items_weight": 1.5,
"coupons": [
{
"coupon": "SUMMER20",
"label": "Summer Sale 20% Off",
"saving": "$23.20",
"saving_html": "<strong>$23.20</strong>"
}
],
"needs_payment": true,
"needs_shipping": true,
"shipping": {
"total_packages": 1,
"show_package_details": true,
"has_calculated_shipping": true,
"packages": {
"default": {
"package_name": "Shipping",
"rates": {
"flat_rate_1": {
"key": "flat_rate:1",
"method_id": "flat_rate",
"instance_id": 1,
"label": "Flat Rate",
"cost": "10.00",
"html": "Flat Rate: $10.00",
"taxes": "1.00",
"chosen_method": true
},
"free_shipping_2": {
"key": "free_shipping:2",
"method_id": "free_shipping",
"instance_id": 2,
"label": "Free Shipping",
"cost": "0.00",
"html": "Free Shipping",
"taxes": "0.00",
"chosen_method": false
}
},
"package_details": "Shipped from Main Warehouse",
"index": 0,
"chosen_method": "flat_rate:1",
"formatted_destination": "Beverly Hills, CA 90210, US"
}
}
},
"fees": [
{
"name": "Gift Wrapping",
"amount": 5,
"taxable": true,
"tax_class": "standard",
"total": 5,
"tax": 0.5
}
],
"taxes": [
{
"rate_id": 1,
"label": "Sales Tax",
"compound": false,
"tax_total": "13.10",
"shipping_tax_total": "1.00"
}
],
"totals": {
"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"
},
"removed_items": [],
"cross_sells": [
{
"id": 312,
"product_name": "Wireless Charging Pad",
"product_title": "Wireless Charging Pad",
"price": "$29.99",
"regular_price": "$39.99",
"sale_price": "$29.99",
"product_image": "https://example-store.com/wp-content/uploads/2024/03/charging-pad.jpg"
},
{
"id": 445,
"product_name": "Phone Case - Universal",
"product_title": "Phone Case - Universal",
"price": "$15.99",
"regular_price": "$15.99",
"sale_price": "",
"product_image": "https://example-store.com/wp-content/uploads/2024/03/phone-case.jpg"
}
],
"extensions": {}
}Unique identifier for the cart/customer.
Specify each parent field you want to request separated by (,) in the response before the data is fetched.
Return the default cart data if set to true.
True if you want to return the URL of the featured product image for each item in the cart.
Cart retrieved successfully.
Complete cart object with enhanced v2 structure.
Unique cart hash.
Unique cart key for the customer.
Show child attributes
Currency code.
Currency symbol.
Currency symbol position.
Currency minor unit.
Currency decimal separator.
Currency thousand separator.
Currency prefix.
Currency suffix.
Show child attributes
Show child attributes
Show child attributes
Cart items indexed by item key.
Show child attributes
Show child attributes
Unique identifier for the item within the cart.
Product ID.
Product name.
Product title.
Current product price.
Product slug.
Item metadata.
Show child attributes
Product type.
Product SKU.
Product weight.
Backorder status.
Custom cart item data.
Product featured image URL.
Total number of items in cart.
Total weight of all items.
Whether the cart needs payment.
Whether the cart needs shipping.
Show child attributes
Number of shipping packages.
Whether to show package details.
Whether shipping has been calculated.
Shipping packages.
Show child attributes
Show child attributes
Package name.
Available shipping rates.
Show child attributes
Show child attributes
Package details.
Package index.
Chosen shipping method.
Formatted destination address.
Show child attributes
Cart subtotal.
Cart subtotal tax.
Shipping total.
Shipping tax.
Discount total.
Discount tax.
Cart contents total.
Cart contents tax.
Fee total.
Fee tax.
Cart total.
Total tax.
Cart notices and messages.
Additional data from extensions.
Was this page helpful?