ReplaceCartEvent

com.salesforce.marketingcloud.sfmcsdk.components.events

An E-commerce event for when a user replaces their shopping cart with a list of items.

  • Target Platform: androidJvm
  • SDK Version: 11.0.0
  • Available Since: 10.0.0

The ReplaceCartEvent class represents a complete replacement of a user’s shopping cart contents. This event is triggered when the entire cart is replaced with a new set of items, as opposed to incrementally adding or removing individual items (which would use AddToCartEvent or RemoveFromCartEvent respectively).

ReplaceCartEvent extends the sealed class CartEvent, which provides cart-specific functionality for engagement events.

  • AddToCartEvent - Event for adding items to the cart
  • RemoveFromCartEvent - Event for removing items from the cart

A list of line items associated with the cart event. Each LineItem represents a product or catalog object being replaced in the cart.

The Event category Name. Category contains list of allowed values.

Defines the priority level for this engagement event.

Returns: A map containing key-value pairs of event attributes.

Description: The Event attributes for this event.

Returns: The event name as a String.

Description: The name for the event. This value must match the Event Name used when creating the event in the Marketing Cloud UI for any action to result from tracking this event.

The lineItems property uses the LineItem data class to represent individual products in the cart.

PropertyTypeDescriptionMutable
catalogObjectTypeStringA type name representing the catalog object referenced in the line itemNo
catalogObjectIdStringA unique identifier representing the catalog object referenced in the line itemNo
quantityIntThe number of catalog objects in this line itemNo
priceDouble?The price of the catalog object referenced in the line item (nullable)Yes
currencyString?The currency for the price field (nullable)Yes
attributesMap<String, Any>A map of user-supplied valuesYes
  • As ReplaceCartEvent extends the sealed class CartEvent, it can only be instantiated directly using its constructor
  • The event name returned by the name() method must correspond to event configurations in the Marketing Cloud UI to trigger associated actions
  • ReplaceCartEvent is part of the engagement tracking system and integrates with Salesforce Marketing Cloud for e-commerce analytics
  • When creating a ReplaceCartEvent, you must provide a list of LineItem objects representing the complete new contents of the cart