removeFromCart
Removes a voucher from the cart by cartId. Since multiple vouchers with the same voucher id can be added to the cart, a unique cartId is created for each one.
The remover
payload property accepts a callback that provides the carts' content as an array
and should return a single cartId.
Example
rpt({
widget: 'vouchers',
command: 'removeFromCart',
payload: { remover: (cartContent) => cartContent[0]?.cartId },
})
Payload
Property | Type | Description |
---|---|---|
remover | function<Array<CartItem>> => number | a callback that receives the carts' content as an argument and should return a single cartId |
CartItem
Property | Type | Description |
---|---|---|
cartId | number | A unique id for each voucher |
voucherId | number | Id of the voucher |
name | string | Title of the voucher |
price | number | Final selling price of the voucher |