Documentation is still being updated. Some content maybe unfinished.
curl --request POST \
--url {protocol}://{host}/wp-json/cocart/v2/cart/clear \
--header 'Content-Type: application/json' \
--data '
{
"keep_removed_items": false
}
'{
"cart_hash": "<string>",
"cart_key": "<string>",
"currency": {
"currency_code": "<string>",
"currency_symbol": "<string>",
"currency_symbol_pos": "<string>",
"currency_minor_unit": 123,
"currency_decimal_separator": "<string>",
"currency_thousand_separator": "<string>",
"currency_prefix": "<string>",
"currency_suffix": "<string>"
},
"customer": {
"billing_address": {
"billing_first_name": "<string>",
"billing_last_name": "<string>",
"billing_company": "<string>",
"billing_country": "<string>",
"billing_address_1": "<string>",
"billing_address_2": "<string>",
"billing_postcode": "<string>",
"billing_city": "<string>",
"billing_state": "<string>",
"billing_phone": "<string>",
"billing_email": "<string>"
},
"shipping_address": {
"shipping_first_name": "<string>",
"shipping_last_name": "<string>",
"shipping_company": "<string>",
"shipping_country": "<string>",
"shipping_address_1": "<string>",
"shipping_address_2": "<string>",
"shipping_postcode": "<string>",
"shipping_city": "<string>",
"shipping_state": "<string>"
}
},
"items": {},
"item_count": 123,
"items_weight": 123,
"coupons": [
{
"coupon": "<string>",
"label": "<string>",
"saving": "<string>",
"saving_html": "<string>"
}
],
"needs_payment": true,
"needs_shipping": true,
"shipping": {
"total_packages": 123,
"show_package_details": true,
"has_calculated_shipping": true,
"packages": {}
},
"fees": [
{
"name": "<string>",
"amount": 123,
"taxable": true,
"tax_class": "<string>",
"total": 123,
"tax": 123
}
],
"taxes": [
{
"rate_id": 123,
"label": "<string>",
"compound": true,
"tax_total": "<string>",
"shipping_tax_total": "<string>"
}
],
"totals": {
"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>"
},
"removed_items": [
{
"key": "<string>",
"product_id": 123,
"quantity": 123,
"name": "<string>"
}
],
"cross_sells": [
{
"id": 123,
"product_name": "<string>",
"product_title": "<string>",
"price": "<string>",
"regular_price": "<string>",
"sale_price": "<string>",
"product_image": "<string>"
}
],
"notices": {},
"extensions": {}
}Removes all items from the customer’s cart.
A valid request URL is required to generate request examples{
"cart_hash": "<string>",
"cart_key": "<string>",
"currency": {
"currency_code": "<string>",
"currency_symbol": "<string>",
"currency_symbol_pos": "<string>",
"currency_minor_unit": 123,
"currency_decimal_separator": "<string>",
"currency_thousand_separator": "<string>",
"currency_prefix": "<string>",
"currency_suffix": "<string>"
},
"customer": {
"billing_address": {
"billing_first_name": "<string>",
"billing_last_name": "<string>",
"billing_company": "<string>",
"billing_country": "<string>",
"billing_address_1": "<string>",
"billing_address_2": "<string>",
"billing_postcode": "<string>",
"billing_city": "<string>",
"billing_state": "<string>",
"billing_phone": "<string>",
"billing_email": "<string>"
},
"shipping_address": {
"shipping_first_name": "<string>",
"shipping_last_name": "<string>",
"shipping_company": "<string>",
"shipping_country": "<string>",
"shipping_address_1": "<string>",
"shipping_address_2": "<string>",
"shipping_postcode": "<string>",
"shipping_city": "<string>",
"shipping_state": "<string>"
}
},
"items": {},
"item_count": 123,
"items_weight": 123,
"coupons": [
{
"coupon": "<string>",
"label": "<string>",
"saving": "<string>",
"saving_html": "<string>"
}
],
"needs_payment": true,
"needs_shipping": true,
"shipping": {
"total_packages": 123,
"show_package_details": true,
"has_calculated_shipping": true,
"packages": {}
},
"fees": [
{
"name": "<string>",
"amount": 123,
"taxable": true,
"tax_class": "<string>",
"total": 123,
"tax": 123
}
],
"taxes": [
{
"rate_id": 123,
"label": "<string>",
"compound": true,
"tax_total": "<string>",
"shipping_tax_total": "<string>"
}
],
"totals": {
"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>"
},
"removed_items": [
{
"key": "<string>",
"product_id": 123,
"quantity": 123,
"name": "<string>"
}
],
"cross_sells": [
{
"id": 123,
"product_name": "<string>",
"product_title": "<string>",
"price": "<string>",
"regular_price": "<string>",
"sale_price": "<string>",
"product_image": "<string>"
}
],
"notices": {},
"extensions": {}
}Keeps removed items in session when clearing the cart.
Cart cleared 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?