removeProduct( )


Deprecated. This function will continue to work, but a newer version is available at wix-ecom-backend.currentCart.removeLineItemsFromCurrentCart().

Migration Instructions

If this function is already in your code, it will continue to work. To stay compatible with future changes, migrate to wix-ecom-backend.currentCart.removeLineItemsFromCurrentCart().

To migrate to the new function:

  1. Add the new import statement:

    Copy
  2. Look for any code that uses cart.removeProduct(), and replace it with currentCart.removeLineItemsFromCurrentCart(). Update your code to work with the new currentCart.removeLineItemsFromCurrentCart() call and response properties.

  3. Test your changes to make sure your code behaves as expected.

Removes a specified product from the cart.

The removeProduct() function returns a Promise that resolves to the updated cart after the product is removed. Every line item in a cart has an ID. Pass this to removeProduct() to remove that line item/product from the cart.

Notes:

  • removeProduct() does not decrement the line item's quantity, it removes the line item/product altogether.
  • When editing a site as a contributor, removeProduct() will only work when viewing the live site.
Method Declaration
Copy
Method Parameters
cartLineItemIdnumberRequired

ID of the cart line item to remove.

Returns
Return Type:Promise<CartObj>
Did this help?