Remove from Cart
Reports that the user removed an item from the cart.
Note
The Remove from Cart event uses the same schema as Add to Cart, except for its dyType property value. Unlike Add to Cart, this event isn't mandatory unless you're using features that rely on Dynamic Yield holding the most up-to-date cart state, like Reconnect campaigns.
Parameters
- name: Human-readable name, not used to identify an event type
- properties: A container for the event properties as specified in the following table:
Property | Description | Type |
---|---|---|
dyType | Must be "remove-from-cart-v1". | String |
value | The total monetary value of the event (item or items added that triggered the event only). Note that this is not all the items in the cart. See the code example that follows after this table (productId "item-34454", quantity 2, itemPrice 59.13: Value is 118.26. The other item in the cart is not included.) | Float (dollars.cents). Numbers are rounded to the nearest 0.01. Numbers smaller than 0.005 are rounded down to 0. |
currency Optional, but required for multi-currency sites | The currency used for the value | String List of supported currencies |
productId | The SKU exactly as it appears in the product feed | String |
quantity | The number of items removed | Number |
cart Optional, but recommended | The cart's current state, after the removal of the item. Products are ordered from the first added to the cart to the most recent. | Object See the cart property table that follows for details. |
Cart object properties:
Property | Description | Type |
---|---|---|
productId | SKU exactly as it appears in the product feed | String |
quantity | Number of items | Number |
itemPrice | The price of the item added | Float in the format: dollars.cents |
Example: Implementation via script
DY.API("event", {
name: "Remove from Cart",
properties: {
dyType: "remove-from-cart-v1",
value: 34.45,
currency: "any supported currency code",
productId: "gswefd-34-454",
quantity: 1,
size: "XL"
cart: [{
productId: "sku-4324-bg",
quantity: 2,
itemPrice: 12.34,
},
{
productId: "item-34454",
quantity: 1,
itemPrice: 34.45
}
]
}
});
Example: Implementation via Experience API (server-side)
"events":[
{
name: "Remove from Cart",
properties: {
dyType: "remove-from-cart-v1",
value: 68.90,
currency: "any supported currency code",
productId: "gswefd-34-454",
quantity: 2,
size: "XL"
cart: [{
productId: "sku-4324-bg",
quantity: 2,
itemPrice: 12.34,
},
{
productId: "item-34454",
quantity: 1,
itemPrice: 34.45
}
]
}
}]
Go to the API reference for the Events endpoint to learn more.
Updated 7 months ago