Deprecated.
This function will continue to work, but a newer version is available at
wix-ecom-backend.currentCart.updateCurrentCart()
.
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.updateCurrentCart()
.
To migrate to the new function:
Add the new import statement:
Look for any code that uses cart.applyCoupon()
,
and replace it with currentCart.updateCurrentCart()
.
Update your code to work with the new currentCart.updateCurrentCart()
call and response properties.
Test your changes to make sure your code behaves as expected.
Adds and applies a coupon to the cart.
The applyCoupon()
function returns a Promise that resolves to the current
site visitor's cart when the specified coupon has been applied.
The cart can only hold one coupon. If a coupon is already applied to the cart, passing a different couponCode
to applyCoupon()
will replace the existing one.
Note: When editing a site as a contributor, applyCoupon()
will only work when viewing the live site.
The code of the coupon to be applied to the cart.