Deprecated. This function will continue to work, but a newer version is available at wix-ecom-backend.currentCart.addToCurrentCart().
The addToCart()
function returns a Promise that is resolved when the
specified product is added to the shopping cart.
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.addToCurrentCart()
.
To migrate to the new function:
Add the new import statement:
Look for any code that uses $w('#shoppingCartIcon').addToCart()
,
and replace it with with cart.addProducts()
.
Note: '#shoppingCartIcon'
might be named differently in your code.
Update your code to work with the new cart.addProducts()
call and response properties.
Test your changes to make sure your code behaves as expected.
The ID of the product to add to the cart.
The number of product units to add to the cart. If omitted, one product unit will be added.
Product options.