Skip to main content

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

PropertyTypeDescription
removerfunction<Array<CartItem>> => numbera callback that receives the carts' content as an argument
and should return a single cartId

CartItem

PropertyTypeDescription
cartIdnumberA unique id for each voucher
voucherIdnumberId of the voucher
namestringTitle of the voucher
pricenumberFinal selling price of the voucher