LineItem

Package: com.salesforce.marketingcloud.sfmcsdk.components.events

Version: 11.0.0

Description 

A data class representing line items for Cart and Order events in the Salesforce Marketing Cloud Unified SDK. Line items describe purchasable catalog objects with quantity, pricing, and additional attributes.

Class Declaration 

1data class LineItem @JvmOverloads constructor(
2    val catalogObjectType: String,
3    val catalogObjectId: String,
4    val quantity: Int,
5    var price: Double? = null,
6    var currency: String? = null,
7    var attributes: Map<String, Any> = mapOf()
8)

Constructor 

Primary Constructor 

ParameterTypeRequiredDefaultDescription
catalogObjectTypeStringYes-Type name for the catalog object
catalogObjectIdStringYes-Unique identifier for the catalog object
quantityIntYes-Number of items in this line item
priceDouble?NonullPrice of the catalog object
currencyString?NonullCurrency code for the price
attributesMap<String, Any>NomapOf()User-supplied attribute values

Properties 

catalogObjectType 

1val catalogObjectType: String

A type name representing the referenced catalog object.

catalogObjectId 

1val catalogObjectId: String

A unique identifier for the catalog object.

quantity 

1val quantity: Int

The count of catalog objects in this line item.

price 

1var price: Double?

The price of the referenced catalog object (mutable, nullable).

currency 

1var currency: String?

The currency code for the price field (mutable, nullable).

attributes 

1var attributes: Map<String, Any>

A map of custom user-supplied values (mutable).