> ## Documentation Index
> Fetch the complete documentation index at: https://help.experro.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Checkout Completed

## Checkout Completed (`checkout_completed`)

**Purpose:**
Track when a user successfully completes their order, capturing final transaction details and full line-item breakdown.

**When to Fire:**
Immediately after the confirmation or “Thank You” page renders — as soon as the order is finalized in your system.

**Payload Schema:**

| Field                     | Type             | Description                                                                                     |
| ------------------------- | ---------------- | ----------------------------------------------------------------------------------------------- |
| `total_value`             | number           | Total order value (`totalValue`).                                                               |
| `total_quantity`          | number           | Total number of items purchased (`totalQuantity`).                                              |
| `cart_id`                 | string           | Identifier of the cart session prior to purchase.                                               |
| `order_id`                | string           | Unique identifier of the completed order.                                                       |
| `currency_code`           | string           | Currency code for the transaction (e.g. `"USD"`).                                               |
| `total_ex_tax`            | number           | Total order amount excluding tax.                                                               |
| `products`                | array of objects | List of cart items, each with detailed fields:                                                  |
|   – `sku`                 | string           | Product SKU.                                                                                    |
|   – `variant_sku`         | string           | Selected variant SKU.                                                                           |
|   – `product_category`    | array of objects | Category hierarchy, each `{ id, name, provider_id }`.                                           |
|   – `mode`                | string           | Origin of the item addition (`"widget"`, `"search"`, `"category"`, `"collection"`, `"direct"`). |
|   – `search_term`         | string           | User search input if applicable.                                                                |
|   – `search_location`     | string           | `"quick"` or `"page"` if from search.                                                           |
|   – `category`            | string           | Category ID or name if from category.                                                           |
|   – `collection`          | string           | Collection ID or name if from collection.                                                       |
|   – `total_value`         | number           | Extended sale price (`quantity * sale_price`).                                                  |
|   – `quantity`            | number           | Units of this SKU in the cart.                                                                  |
|   – `widget_rule`         | string           | Rule ID that applied.                                                                           |
|   – `widget_rule_type`    | string           | Type of rule.                                                                                   |
|   – `widget_id`           | string           | Widget instance ID if relevant.                                                                 |
|   – `widget_context_type` | string           | Context entity type.                                                                            |
|   – `widget_context_data` | string           | Additional context payload.                                                                     |
|   – `facets`              | array            | Active filters on the cart page.                                                                |
|   – `product_option`      | array of objects | Selected product options per item, each `{ name, value }`.                                      |
|  – `request_id`           | string           | Unique identifier                                                                               |
|  – `page_depth`           | string           | Current page number (1, 2, 3, etc.).                                                            |

**Example:**

```js theme={null}
// After order confirmation:
const order = {
  totalValue:       250.00,
  total_quantity:    2,
  cart_id:          'CART-789',
  order_id:         'ORDER-456',
  currency_code:    'USD',
  total_ex_tax:          230.00,
  items: [
    {
      sku: 'PROD-001',
      variant_sku: 'PROD-001-BLUE',
      product_category: [{ id: 'apparel', name: 'Apparel', provider_id: 'prov1' }],
      total_value: 129.99,
      quantity: 1,
      mode: 'direct',
      mode_details: {
       search_term: 'jack',
       search_location: 'page',
       search_source: 'search_suggestion',
       used_suggestion: 'jacket',
       category: null,
       collection: null,
       widget_rule: null,
       widget_rule_type: null,
       widget_id: null,
       widget_context_type: 'direct',
       widget_context_data: '',
       request_id: requestId,
       page_depth: currentPage,
       facets: [],
      },
      product_option: [{ name: 'Size', value: 'M' }]
    }
  ]
};


ExpAnalyticsService.trackCheckoutCompleted({
    total_value: order.totalValue,
    total_quantity: order.total_quantity,
    order_id: order.order_id,
    cart_id: order.cart_id,
    currency_code: order.currency_code,
    total_ex_tax: order.total_ex_tax,
    products: order.items || [],
});
```
