Cart Interactions
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 |
|
id |
|
lineItems |
|
name |
|
Add to Cart Interaction Event
event.target.dispatchEvent(
new CustomEvent('experience_interaction', {
bubbles: true,
composed: true,
detail: {
name: 'cart-add',
cart: {
id: 'cart-12345',
lineItems: {
id: 'line-item-12345',
catalogObject: {
id: 'catalog-id-12345678',
type: 'Product'
},
attributes: {
quantity: 12,
price: 2.5,
imageUrl: 'https://commerce.salesforce.com/blueshirt.jpg',
name: 'blue-shirt'
},
},
attributes: {
currency: '$',
name: 'my-personal-cart',
},
},
},
})
);
Remove from Cart Interaction Event
event.target.dispatchEvent(
new CustomEvent('experience_interaction', {
bubbles: true,
composed: true,
detail: {
name: 'cart-remove',
cart: {
id: 'cart-12345',
lineItems: {
id: 'line-item-23112',
},
attributes: {
name: 'my-personal-cart'
},
},
},
})
);
Update Cart Interaction Event
event.target.dispatchEvent(
new CustomEvent('experience_interaction', {
bubbles: true,
composed: true,
detail: {
name: 'cart-update',
cart: {
id: 'cart-61221',
lineItems: {
id: 'line-item-11111',
attributes: {
quantity: 2,
},
},
attributes: {
name: 'my-updated-cart'
},
},
},
})
);