Skip to main content
PUT
/
cart
/
item
/
{item_key}
Restore cart item
curl --request PUT \
  --url {protocol}://{host}/wp-json/cocart/v2/cart/item/{item_key}
{
  "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": {}
}

Path Parameters

item_key
string
required

Unique identifier for the cart item.

Query Parameters

return_item
boolean
default:false

Returns the item details once restored.

Response

Cart item restored successfully.

  • Option 1
  • Option 2

Complete cart object with enhanced v2 structure.

cart_hash
string

Unique cart hash.

cart_key
string

Unique cart key for the customer.

currency
object
customer
object
items
object

Cart items indexed by item key.

item_count
integer

Total number of items in cart.

items_weight
number

Total weight of all items.

coupons
object[]

Applied coupons.

needs_payment
boolean

Whether the cart needs payment.

needs_shipping
boolean

Whether the cart needs shipping.

shipping
object
fees
object[]

Cart fees.

taxes
object[]

Cart taxes.

totals
object
removed_items
object[]

Recently removed items that can be restored.

cross_sells
object[]

Cross-sell products.

notices
object

Cart notices and messages.

extensions
object

Additional data from extensions.

I