Cart Interactions

A cart interaction occurs when a customer interacts with their cart or checkout. 

Interaction NameDescription
cart-addCaptures an event for the addition of an item to a cart.
cart-removeCaptures an event for the removal of an item from a cart.
cart-replaceCaptures an event for the replacement of all items in a cart at the same time.
cart-updateCaptures events for updates to a cart.
cart-viewCaptures an event for when a user views their cart. Available in package version 1.3 and later
checkout-apply-couponCaptures an event that occurs when a user applies a coupon during checkout. Available in package version 1.3 and later.
checkout-beginCaptures an event for when a checkout begins. Available in package version 1.3 and later.
checkout-billing-addressCaptures an event that occurs when a user enters their billing address during checkout. Available in package version 1.3 and later.
checkout-contact-infoCaptures an event that occurs when a user enters their contact info during checkout. Available in package version 1.3 and later.
checkout-paymentCaptures an event that occurs when a user makes a payment during checkout. Available in package version 1.3 and later.
checkout-reviewCaptures an event that occurs when a user selects review checkout before submitting their order. Available in package version 1.3 and later.
checkout-shipping-addressCaptures an event that occurs when a user enters their shipping address during checkout. Available in package version 1.3 and later.
checkout-shipping-optionsCaptures an event that occurs when a user chooses a shipping option during checkout. Available in package version 1.3 and later.
checkout-submitCaptures 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-registerCaptures an event that occurs when a user registers during checkout. Available in package version 1.3 and later.
order-acceptedCaptures an event that occurs when an order is accepted and ready for fulfillment. Available in package version 1.3 and later.

Fields 

FieldTypeDetails
attributesobjectA dictionary of values that you supply.
idstringRequired. A unique ID representing the Cart object.
lineItemsLine Item DataRequired. A single Line Item Data value.
namestringRequired. 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);