Cart Interactions

A cart interaction occurs when a customer interacts with their cart or checkout. 
Interaction Name Description
cart-add Captures an event for the addition of an item to a cart.
cart-remove Captures an event for the removal of an item from a cart.
cart-replace Captures an event for the replacement of all items in a cart at the same time.
cart-update Captures events for updates to a cart.
cart-view Captures an event for when a user views their cart. Available in package version 1.3 and later
checkout-apply-coupon Captures an event that occurs when a user applies a coupon during checkout. Available in package version 1.3 and later.
checkout-begin Captures an event for when a checkout begins. Available in package version 1.3 and later.
checkout-billing-address Captures an event that occurs when a user enters their billing address during checkout. Available in package version 1.3 and later.
checkout-contact-info Captures an event that occurs when a user enters their contact info during checkout. Available in package version 1.3 and later.
checkout-payment Captures an event that occurs when a user makes a payment during checkout. Available in package version 1.3 and later.
checkout-review Captures an event that occurs when a user selects review checkout before submitting their order. Available in package version 1.3 and later.
checkout-shipping-address Captures an event that occurs when a user enters their shipping address during checkout. Available in package version 1.3 and later.
checkout-shipping-options Captures an event that occurs when a user chooses a shipping option during checkout. Available in package version 1.3 and later.
checkout-submit Captures an event that occurs when a user submits their order at the end of the checkout process. Available in package version 1.3 and later.
checkout-user-register Captures an event that occurs when a user registers during checkout. Available in package version 1.3 and later.
order-accepted Captures an event that occurs when an order is accepted and ready for fulfillment. Available in package version 1.3 and later.

Fields

Field Details
attributes
Type
object
Description
A dictionary of values that you supply.
id
Type
string
Description
Required. A unique ID representing the Cart object.
lineItems
Type
Line Item Data
Description
Required. A single Line Item Data value.
name
Type
string
Description
Required. The event name.

Add to Cart Interaction Event

1event.target.dispatchEvent(
2   new CustomEvent('experience_interaction', {
3      bubbles: true,
4      composed: true,
5      detail: {
6         name: 'cart-add',
7         cart: {
8            id: 'cart-12345',
9            lineItems: {
10               id: 'line-item-12345',
11               catalogObject: {
12                  id: 'catalog-id-12345678',
13                  type: 'Product'
14               },
15               attributes: {
16                  quantity: 12,
17                  price: 2.5,
18                  imageUrl: 'https://commerce.salesforce.com/blueshirt.jpg',
19                  name: 'blue-shirt'
20               },
21            },
22            attributes: {
23               currency: '$',
24               name: 'my-personal-cart',
25            },
26         },
27      },
28   })
29);

Remove from Cart Interaction Event

1event.target.dispatchEvent(
2   new CustomEvent('experience_interaction', {
3      bubbles: true,
4      composed: true,
5      detail: {
6         name: 'cart-remove',
7         cart: {
8            id: 'cart-12345',
9            lineItems: {
10               id: 'line-item-23112',
11            },
12            attributes: {
13               name: 'my-personal-cart'
14            },
15         },
16      },
17   })
18);

Update Cart Interaction Event

1event.target.dispatchEvent(
2   new CustomEvent('experience_interaction', {
3      bubbles: true,
4      composed: true,
5      detail: {
6         name: 'cart-update',
7         cart: {
8            id: 'cart-61221',
9            lineItems: {
10               id: 'line-item-11111',
11               attributes: {
12                  quantity: 2,
13               },
14            },
15            attributes: {
16               name: 'my-updated-cart'
17            },
18         },
19      },
20   })
21);