Cart Details

Overview

The Cart Details API provides comprehensive information about customer shopping carts. This documentation outlines all available fields and their values that you can access through the API.

Note: The REST API always accepts and returns data as strings and arrays/objects. The Values column in the tables below indicates the expected data type of each field.

Cart Object Fields

The following fields represent the core properties of a cart object:

Field Values Description
user_id integer A unique identifier of the cart owner.
firstname string Cart owner's first name.
lastname string Cart owner's last name.
date integer The UNIX timestamp when the cart was created.
ip_address string The IP address of the cart owner.
company_id integer The ID of the vendor associated with the cart.
cart_products integer The number of items in the cart. Multiple instances of one product count as separate items.
total float The total price of the products in the cart.
order_id integer The ID of the order associated with the cart (if the cart has been checked out).
user_data object Detailed information about the cart owner. Available only if the cart belongs to a registered user.
products array An array that contains the information about products in the cart.

Products Array

The products array contains detailed information about each product in the cart:

Field Values Description
product_id integer ID of the product.
amount integer The quantity of this product in the cart.
price float The unit price of the product.
product string The name of the product.
options array Selected product options (color, size, etc.).
subtotal float The total price for this product (amount × price).

Example Response

Below is an example of a complete cart details response:

{
  "user_id": "42",
  "firstname": "John",
  "lastname": "Doe",
  "date": "1681556400",
  "ip_address": "192.168.1.1",
  "company_id": "1",
  "cart_products": "3",
  "total": "199.97",
  "order_id": "0",
  "user_data": {
    "email": "john.doe@example.com",
    "phone": "+1 (555) 123-4567"
  },
  "products": [
    {
      "product_id": "123",
      "amount": "2",
      "price": "49.99",
      "product": "Premium T-Shirt",
      "options": [
        {
          "option_id": "12",
          "option_name": "Size",
          "value": "Large"
        },
        {
          "option_id": "15",
          "option_name": "Color",
          "value": "Blue"
        }
      ],
      "subtotal": "99.98"
    },
    {
      "product_id": "456",
      "amount": "1",
      "price": "99.99",
      "product": "Designer Jeans",
      "options": [
        {
          "option_id": "18",
          "option_name": "Size",
          "value": "32"
        }
      ],
      "subtotal": "99.99"
    }
  ]
}
Tip: When working with cart data, always check the order_id field to determine if a cart has been converted to an order. A non-zero value indicates the cart has been checked out.