Line Item Data
A line item is used to describe a single, specific instance of a purchasable item as it appears within a transaction, such as a shopping cart, an order, or a return.
Line items are only used within transactional interactions, specifically:
Line Item Object Structure
Line item objects are typically passed as an array (even if only one item is present) under the lineItems property of the main event payload.
| Field | Type | Description |
|---|---|---|
catalogObjectType | string | Required. The type of catalog object being referenced (for example, Product, Service). |
catalogObjectId | string | Required. The unique identifier for the specific item (such as, SKU). |
quantity | number | Required. The number of units of this item in the transaction. |
price | number | The unit price of the item. |
currency | string | The currency code for the price field (for example, USD, EUR). |
attributes | object | An object for any custom data specific to this line item. |
| Field | Type | Description |
|---|---|---|
attributes | object | An object for any custom data specific to this line item. |
catalogObjectId | string | Required. A unique identifier representing the catalog object referenced in the line item. |
catalogObjectType | string | Required. A name representing the catalog object referenced in the line item. |
currency | string | The currency of the price field. |
price | number | The price of the catalog object referenced in the line item. |
quantity | number | Required. The number of catalog objects in this line item. |
Example: Line Item in a Cart Interaction
This example shows how a line item is structured when used within a Cart View interaction, typically defined within a Sitemap to collect cart details on the cart page.
1// This data would be collected and sent via SalesforceInteractions.sendEvent()
2{
3 interaction: {
4 name: 'View Cart',
5 lineItems: [
6 // First Line Item
7 {
8 catalogObjectType: "Product",
9 catalogObjectId: "product-1",
10 quantity: 1,
11 price: 9.99,
12 currency: "USD",
13 attributes: {
14 giftWrapping: true // Custom attribute for this specific item
15 }
16 },
17 // Second Line Item
18 {
19 catalogObjectType: "Product",
20 catalogObjectId: "product-x",
21 quantity: 2,
22 price: 15.00,
23 currency: "USD"
24 }
25 ]
26 }
27}See Also