addToCart( )


Adds catalog line items to a cart.

The addToCart() function returns a Promise that resolves to the updated cart when the specified items have been added.

Notes:

  • When adding catalog line items, the lineItems.catalogReference.appId and lineItems.catalogReference.catalogItemId fields are required.
  • After a cart is updated, call Refresh Cart to update the cart's UI elements and trigger the Cart Updated event.
Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage eCommerce - all permissions
Manage eCommerce - Admin Permissions
Learn more about app permissions.
Method Declaration
Copy
Method Parameters
_idstringRequired

Cart ID.


optionsAddToCartOptions

Items to be added to cart.

Returns
Return Type:Promise<AddToCartResponse>
Errors

This method doesn't return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?