import { CartObj, CartChangedHandler } from './common.types'; /** * **Deprecated.** * The `wix-stores-frontend.Cart` module will continue to work, but newer functions are available at * [`wix-ecom-frontend`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-frontend/introduction) and [`wix-ecom-backend.CurrentCart`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/introduction). * * > **Note:** * > The `wix-stores-frontend.Cart` modules is deprecated. * > If you're already using this modules in your code, it will continue to work. * > To stay compatible with future changes, update your code * > with the migration instructions in this module's functions. * * The `wix-stores-frontend.Cart` module contains functionality for working with a * site's cart from frontend code. * * To use the Wix Stores Cart API, import `{ cart }` from the `wix-stores-frontend` module: * * ```javascript * import { cart } from 'wix-stores-frontend'; * ``` */ export interface Cart { /** * **Deprecated.** * This function will continue to work, but a newer version is available at * [`wix-ecom-backend.currentCart.addToCurrentCart()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/add-to-current-cart). * * > #### 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.addToCurrentCart()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/add-to-current-cart). * > * > To migrate to the new function: * > * > 1. Add the new import statement: * > * > ```javascript * > import { currentCart } from "wix-ecom-backend"; * > ``` * > * > 2. Look for any code that uses `cart.addProducts()`, * > and replace it with `currentCart.addToCurrentCart()`. * > Update your code to work with the new `currentCart.addToCurrentCart()` call and response properties. * > * > To help with updating your code to work with the new `currentCart.addToCurrentCart()` properties, learn more about [integrating Wix Stores with the Wix eCommerce](https://dev.wix.com/docs/velo/api-reference/wix-stores-backend/e-commerce-integration). * > * > 3. Test your changes to make sure your code behaves as expected. * * Adds one or more products to the cart. * * The `addProducts()` function returns a Promise that is resolved when the * specified products are added to the cart. * * Use the `quantity` property of each `AddToCartItem` object that is * passed to the products parameter to add one or more products to the cart at one time. * * Use the `options` property of each `AddToCartItem` object that is * passed to the products parameter to specify the product options to choose when adding * the product to the cart. For example, if a product comes in different sizes, you can * specify the size that should be added to the cart. If the product you are adding to the * cart has options, you must specify which options should be chosen. * * You can see a product's option information in the `productOptions` field in the **Stores/Products** collection. * * You can use [`product.getOptionsAvailability()`](https://www.wix.com/velo/reference/wix-stores-frontend/product/getoptionsavailability) * to determine if an item with specific options is available for purchase. * * > **Note:** If you use [`wix-stores-backend.createProduct()`](https://www.wix.com/velo/reference/wix-stores-backend/createproduct) immediately before adding that product to the cart, we suggest [setting a timeout](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout) for `"1000"` milliseconds (1 second) before calling `cart.addProducts()`. While this slows down the operation slightly, it also ensures proper retrieval of the newly created product before adding it to the cart. * @param products - One or more products to be added to the cart. * @requiredField products * @servicePath wix-stores-frontend.Cart.AddToCartItem * @returns Fulfilled - The updated cart with added products. * @servicePath wix-stores-frontend.CartObj */ addProducts(products: AddToCartItem[]): Promise; /** * **Deprecated.** * This function will continue to work, but a newer version is available at * [`wix-ecom-backend.currentCart.updateCurrentCart()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/update-current-cart). * * > #### 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.updateCurrentCart()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/update-current-cart). * > * > To migrate to the new function: * > * > 1. Add the new import statement: * > * > ```javascript * > import { currentCart } from "wix-ecom-backend"; * > ``` * > * > 2. 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. * > * > 3. 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](https://support.wix.com/en/article/velo-working-with-contributors), `applyCoupon()` will only work when viewing the live site. * @param couponCode - The code of the coupon to be applied to the cart. * @requiredField couponCode * @returns Fulfilled - The updated cart. * @servicePath wix-stores-frontend.CartObj */ applyCoupon(couponCode: string): Promise; /** * **Deprecated.** * This function will continue to work, but a newer version is available at * [`wix-ecom-backend.CurrentCart.getCurrentCart()`](https://www.wix.com/velo/reference/wix-ecom-backend/currentcart/getcurrentcart). * * We recommend you migrate to the new [Wix eCommerce APIs](https://www.wix.com/velo/reference/wix-ecom-backend/introduction) as soon as possible. * * > #### 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.getCurrentCart()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/currentcart/getcurrentcart). * > * > The `wix-ecom-backend.CurrentCart.getCurrentCart()` function works from both backend and frontend code. * > * > To migrate to the new function: * > * > 1. Add the new import statement: * > * > ```javascript * > import { currentCart } from 'wix-ecom-backend'; * > ``` * > * > 2. Look for any code that uses `cart.getCurrentCart()`, * > and replace it with `currentCart.getCurrentCart()`. * > Update your code to work with the new `currentCart.getCurrentCart()` * > call and response properties. * > For more info about the differences between the Stores Cart and eCommerce Cart, refer to the [cart conversion table](https://www.wix.com/velo/reference/wix-ecom-backend/cart/stores-to-ecommerce-cart-conversion-table). * > * > 3. Test your changes to make sure your code behaves as expected. * * Gets the current site visitor's shopping cart. * * The `getCurrentCart()` function returns a Promise that resolves to the current * site visitor's shopping cart. * * @returns Fulfilled - The retrieved cart. * @servicePath wix-stores-frontend.CartObj */ getCurrentCart(): Promise; /** * **Deprecated.** * This function will continue to work, but will soon be deprecated. Hiding the Mini Cart or Side Cart can be done by clicking anywhere else on the page. * * Hides the Mini Cart. * * The `hideMiniCart()` function hides the Mini Cart. * Learn more about the [Mini Cart](https://support.wix.com/en/article/customizing-the-cart-page). * * > **Note:** This API will fail when viewing the site on mobile because there is no Mini Cart on the mobile site. */ hideMiniCart(): Promise; /** * **Deprecated.** * This function will continue to work, but a newer version is available at * [`wix-ecom-frontend.onCartChange()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-frontend/on-cart-change). * * > #### 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-frontend.onCartChange()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-frontend/on-cart-change). * > * > To migrate to the new function: * > * > 1. Add the new import statement: * > * > ```javascript * > import wixEcomFrontend from "wix-ecom-frontend"; * > ``` * > * > 2. Look for any code that uses `cart.onChange()`, * > and replace it with `wixEcomFrontend.onCartChange()`. * > The new `onCartChange()` event handler does not return the changed cart. Update your code accordingly. * > * > 3. Test your changes to make sure your code behaves as expected. * * * An event handler that is triggered when items are added or removed from a cart. * * The `onChange()` function is a client-side event handler invoked every time the cart changes. It takes a callback function which receives the new `Cart` object as a parameter. * * > **Notes:** * > + Use `onChange()` in the global site code file (masterPage.js). This ensures the event is triggered when a change to the cart is made on any page. Learn more about [global (site) code](https://support.wix.com/en/article/velo-working-with-the-velo-sidebar#global-site). * > + The `onChange()` function can only be used once a page has loaded. Therefore, you must use it in code that is contained in or is called from the [onReady()](https://dev.wix.com/docs/velo/api-reference/$w/on-ready) event handler or any element event handler. * > + When [editing a site as a contributor](https://support.wix.com/en/article/velo-working-with-contributors), `onChange()` will only work when viewing the live site. * @param handler - The name of the function to run when a cart changes. * @requiredField handler * @servicePath wix-stores-frontend.CartChangedHandler */ onChange(handler: CartChangedHandler): Promise; /** * **Deprecated.** * This function will continue to work, but a newer version is available at * [`wix-ecom-backend.currentCart.removeCouponFromCurrentCart()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/remove-coupon-from-current-cart). * * > #### 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.removeCouponFromCurrentCart()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/remove-coupon-from-current-cart). * > * > To migrate to the new function: * > * > 1. Add the new import statement: * > * > ```javascript * > import { currentCart } from "wix-ecom-backend"; * > ``` * > * > 2. Look for any code that uses `cart.removeCoupon()`, * > and replace it with `currentCart.removeCouponFromCurrentCart()`. * > Update your code to work with the new `currentCart.removeCouponFromCurrentCart()` * > call and response properties. * > * > 3. Test your changes to make sure your code behaves as expected. * * Removes the coupon currently applied to the cart. * * The `removeCoupon()` function returns a Promise that resolves to the current * site visitor's cart when the currently applied coupon has been removed. * * > **Note:** When [editing a site as a contributor](https://support.wix.com/en/article/velo-working-with-contributors), `removeCoupon()` will only work when viewing the live site. * * @returns Fulfilled - The updated cart. * @servicePath wix-stores-frontend.CartObj */ removeCoupon(): Promise; /** * **Deprecated.** * This function will continue to work, but a newer version is available at * [`wix-ecom-backend.currentCart.removeLineItemsFromCurrentCart()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/remove-line-items-from-current-cart). * * > #### 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()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/remove-line-items-from-current-cart). * > * > To migrate to the new function: * > * > 1. Add the new import statement: * > * > ```javascript * > import { currentCart } from "wix-ecom-backend"; * > ``` * > * > 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](https://support.wix.com/en/article/velo-working-with-contributors), `removeProduct()` will only work when viewing the live site. * @param cartLineItemId - ID of the cart line item to remove. * @requiredField cartLineItemId * @returns Fulfilled - The updated cart. * @servicePath wix-stores-frontend.CartObj */ removeProduct(cartLineItemId: number): Promise; /** * **Deprecated.** * This function will continue to work, but a newer version is available at * [`wix-ecom-frontend.openSideCart()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-frontend/open-side-cart). * * > #### 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-frontend.openSideCart()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-frontend/open-side-cart). * > * > To migrate to the new function: * > * > 1. Add the new import statement: * > * > ```javascript * > import wixEcomFrontend from "wix-ecom-frontend"; * > ``` * > * > 2. Look for any code that uses `cart.showMiniCart()`, * > and replace it with `wixEcomFrontend.openSideCart()`. * > * > 3. Test your changes to make sure your code behaves as expected. * * Shows the Mini Cart. * * The `showMiniCart()` function displays the Mini Cart. * Learn more about the [Mini Cart](https://support.wix.com/en/article/customizing-the-cart-page). * > **Note:** This API will fail when viewing the site on mobile because there is no Mini Cart on the mobile site. */ showMiniCart(): Promise; /** * **Deprecated.** * This function will continue to work, but a newer version is available at * [`wix-ecom-backend.currentCart.updateCurrentCartLineItemQuantity()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/update-current-cart-line-item-quantity). * * > #### 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.updateCurrentCartLineItemQuantity()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/update-current-cart-line-item-quantity). * > * > To migrate to the new function: * > * > 1. Add the new import statement: * > * > ```javascript * > import { currentCart } from "wix-ecom-backend"; * > ``` * > * > 2. Look for any code that uses `cart.updateLineItemQuantity()`, * > and replace it with `currentCart.updateCurrentCartLineItemQuantity()`. * > Update your code to work with the new `currentCart.updateCurrentCartLineItemQuantity()` * > call and response properties. * * Updates the quantity of a specified line item in the cart. * * The `updateLineItemQuantity()` function returns a Promise that resolves to the current * site visitor's cart when the specified line item's quantity has been updated. * * > **Note:** When [editing a site as a contributor](https://support.wix.com/en/article/velo-working-with-contributors), `updateLineItemQuantity()` will only work when viewing the live site. * @param cartLineItemId - ID of the cart line item to update. * @requiredField cartLineItemId * @param quantity - Line item's new quantity. * @requiredField quantity * @returns Fulfilled - The updated cart. * @servicePath wix-stores-frontend.CartObj */ updateLineItemQuantity(cartLineItemId: number, quantity: number): Promise; } /** * An object used when adding one or more products to the cart. */ export interface AddToCartItem { /** * ID of the product to add to the cart. * @requiredField productId */ productId: string; /** * Number of product units to add to the cart. * @requiredField quantity */ quantity: number; /** * Specific product options to add to the cart. * If the product you're adding has options, you must specify which options to add. * @servicePath wix-stores-frontend.Cart.AddToCartOptions */ options?: AddToCartOptions; } /** * An object used when adding a product to the cart with options. */ export interface AddToCartOptions { /** * Product options to use when adding the * product to the cart. The object contains `key:value` pairs where the key is the option name and the value is the chosen option value. */ choices?: object; /** * Custom text fields to use when adding the product to the cart. * @servicePath wix-stores-frontend.Cart.CustomTextField */ customTextFields?: CustomTextField[]; } /** * An object used to pass a custom text field when adding a product to * the cart with options. */ export interface CustomTextField { /** * Custom text field title. * @requiredField title */ title: string; /** * Custom text field value. * @requiredField value */ value: string; } /** * **Deprecated.** * This function will continue to work, but a newer version is available at * [`wix-ecom-backend.currentCart.addToCurrentCart()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/add-to-current-cart). * * > #### 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.addToCurrentCart()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/add-to-current-cart). * > * > To migrate to the new function: * > * > 1. Add the new import statement: * > * > ```javascript * > import { currentCart } from "wix-ecom-backend"; * > ``` * > * > 2. Look for any code that uses `cart.addProducts()`, * > and replace it with `currentCart.addToCurrentCart()`. * > Update your code to work with the new `currentCart.addToCurrentCart()` call and response properties. * > * > To help with updating your code to work with the new `currentCart.addToCurrentCart()` properties, learn more about [integrating Wix Stores with the Wix eCommerce](https://dev.wix.com/docs/velo/api-reference/wix-stores-backend/e-commerce-integration). * > * > 3. Test your changes to make sure your code behaves as expected. * * Adds one or more products to the cart. * * The `addProducts()` function returns a Promise that is resolved when the * specified products are added to the cart. * * Use the `quantity` property of each `AddToCartItem` object that is * passed to the products parameter to add one or more products to the cart at one time. * * Use the `options` property of each `AddToCartItem` object that is * passed to the products parameter to specify the product options to choose when adding * the product to the cart. For example, if a product comes in different sizes, you can * specify the size that should be added to the cart. If the product you are adding to the * cart has options, you must specify which options should be chosen. * * You can see a product's option information in the `productOptions` field in the **Stores/Products** collection. * * You can use [`product.getOptionsAvailability()`](https://www.wix.com/velo/reference/wix-stores-frontend/product/getoptionsavailability) * to determine if an item with specific options is available for purchase. * * > **Note:** If you use [`wix-stores-backend.createProduct()`](https://www.wix.com/velo/reference/wix-stores-backend/createproduct) immediately before adding that product to the cart, we suggest [setting a timeout](https://developer.mozilla.org/en-US/docs/Web/API/setTimeout) for `"1000"` milliseconds (1 second) before calling `cart.addProducts()`. While this slows down the operation slightly, it also ensures proper retrieval of the newly created product before adding it to the cart. * @param products - One or more products to be added to the cart. * @requiredField products * @servicePath wix-stores-frontend.Cart.AddToCartItem * @returns Fulfilled - The updated cart with added products. * @servicePath wix-stores-frontend.CartObj */ export function addProducts(products: AddToCartItem[]): Promise; /** * **Deprecated.** * This function will continue to work, but a newer version is available at * [`wix-ecom-backend.currentCart.updateCurrentCart()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/update-current-cart). * * > #### 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.updateCurrentCart()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/update-current-cart). * > * > To migrate to the new function: * > * > 1. Add the new import statement: * > * > ```javascript * > import { currentCart } from "wix-ecom-backend"; * > ``` * > * > 2. 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. * > * > 3. 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](https://support.wix.com/en/article/velo-working-with-contributors), `applyCoupon()` will only work when viewing the live site. * @param couponCode - The code of the coupon to be applied to the cart. * @requiredField couponCode * @returns Fulfilled - The updated cart. * @servicePath wix-stores-frontend.CartObj */ export function applyCoupon(couponCode: string): Promise; /** * **Deprecated.** * This function will continue to work, but a newer version is available at * [`wix-ecom-backend.CurrentCart.getCurrentCart()`](https://www.wix.com/velo/reference/wix-ecom-backend/currentcart/getcurrentcart). * * We recommend you migrate to the new [Wix eCommerce APIs](https://www.wix.com/velo/reference/wix-ecom-backend/introduction) as soon as possible. * * > #### 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.getCurrentCart()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/currentcart/getcurrentcart). * > * > The `wix-ecom-backend.CurrentCart.getCurrentCart()` function works from both backend and frontend code. * > * > To migrate to the new function: * > * > 1. Add the new import statement: * > * > ```javascript * > import { currentCart } from 'wix-ecom-backend'; * > ``` * > * > 2. Look for any code that uses `cart.getCurrentCart()`, * > and replace it with `currentCart.getCurrentCart()`. * > Update your code to work with the new `currentCart.getCurrentCart()` * > call and response properties. * > For more info about the differences between the Stores Cart and eCommerce Cart, refer to the [cart conversion table](https://www.wix.com/velo/reference/wix-ecom-backend/cart/stores-to-ecommerce-cart-conversion-table). * > * > 3. Test your changes to make sure your code behaves as expected. * * Gets the current site visitor's shopping cart. * * The `getCurrentCart()` function returns a Promise that resolves to the current * site visitor's shopping cart. * * @returns Fulfilled - The retrieved cart. * @servicePath wix-stores-frontend.CartObj */ export function getCurrentCart(): Promise; /** * **Deprecated.** * This function will continue to work, but will soon be deprecated. Hiding the Mini Cart or Side Cart can be done by clicking anywhere else on the page. * * Hides the Mini Cart. * * The `hideMiniCart()` function hides the Mini Cart. * Learn more about the [Mini Cart](https://support.wix.com/en/article/customizing-the-cart-page). * * > **Note:** This API will fail when viewing the site on mobile because there is no Mini Cart on the mobile site. */ export function hideMiniCart(): Promise; /** * **Deprecated.** * This function will continue to work, but a newer version is available at * [`wix-ecom-frontend.onCartChange()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-frontend/on-cart-change). * * > #### 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-frontend.onCartChange()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-frontend/on-cart-change). * > * > To migrate to the new function: * > * > 1. Add the new import statement: * > * > ```javascript * > import wixEcomFrontend from "wix-ecom-frontend"; * > ``` * > * > 2. Look for any code that uses `cart.onChange()`, * > and replace it with `wixEcomFrontend.onCartChange()`. * > The new `onCartChange()` event handler does not return the changed cart. Update your code accordingly. * > * > 3. Test your changes to make sure your code behaves as expected. * * * An event handler that is triggered when items are added or removed from a cart. * * The `onChange()` function is a client-side event handler invoked every time the cart changes. It takes a callback function which receives the new `Cart` object as a parameter. * * > **Notes:** * > + Use `onChange()` in the global site code file (masterPage.js). This ensures the event is triggered when a change to the cart is made on any page. Learn more about [global (site) code](https://support.wix.com/en/article/velo-working-with-the-velo-sidebar#global-site). * > + The `onChange()` function can only be used once a page has loaded. Therefore, you must use it in code that is contained in or is called from the [onReady()](https://dev.wix.com/docs/velo/api-reference/$w/on-ready) event handler or any element event handler. * > + When [editing a site as a contributor](https://support.wix.com/en/article/velo-working-with-contributors), `onChange()` will only work when viewing the live site. * @param handler - The name of the function to run when a cart changes. * @requiredField handler * @servicePath wix-stores-frontend.CartChangedHandler */ export function onChange(handler: CartChangedHandler): Promise; /** * **Deprecated.** * This function will continue to work, but a newer version is available at * [`wix-ecom-backend.currentCart.removeCouponFromCurrentCart()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/remove-coupon-from-current-cart). * * > #### 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.removeCouponFromCurrentCart()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/remove-coupon-from-current-cart). * > * > To migrate to the new function: * > * > 1. Add the new import statement: * > * > ```javascript * > import { currentCart } from "wix-ecom-backend"; * > ``` * > * > 2. Look for any code that uses `cart.removeCoupon()`, * > and replace it with `currentCart.removeCouponFromCurrentCart()`. * > Update your code to work with the new `currentCart.removeCouponFromCurrentCart()` * > call and response properties. * > * > 3. Test your changes to make sure your code behaves as expected. * * Removes the coupon currently applied to the cart. * * The `removeCoupon()` function returns a Promise that resolves to the current * site visitor's cart when the currently applied coupon has been removed. * * > **Note:** When [editing a site as a contributor](https://support.wix.com/en/article/velo-working-with-contributors), `removeCoupon()` will only work when viewing the live site. * * @returns Fulfilled - The updated cart. * @servicePath wix-stores-frontend.CartObj */ export function removeCoupon(): Promise; /** * **Deprecated.** * This function will continue to work, but a newer version is available at * [`wix-ecom-backend.currentCart.removeLineItemsFromCurrentCart()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/remove-line-items-from-current-cart). * * > #### 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()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/remove-line-items-from-current-cart). * > * > To migrate to the new function: * > * > 1. Add the new import statement: * > * > ```javascript * > import { currentCart } from "wix-ecom-backend"; * > ``` * > * > 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](https://support.wix.com/en/article/velo-working-with-contributors), `removeProduct()` will only work when viewing the live site. * @param cartLineItemId - ID of the cart line item to remove. * @requiredField cartLineItemId * @returns Fulfilled - The updated cart. * @servicePath wix-stores-frontend.CartObj */ export function removeProduct(cartLineItemId: number): Promise; /** * **Deprecated.** * This function will continue to work, but a newer version is available at * [`wix-ecom-frontend.openSideCart()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-frontend/open-side-cart). * * > #### 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-frontend.openSideCart()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-frontend/open-side-cart). * > * > To migrate to the new function: * > * > 1. Add the new import statement: * > * > ```javascript * > import wixEcomFrontend from "wix-ecom-frontend"; * > ``` * > * > 2. Look for any code that uses `cart.showMiniCart()`, * > and replace it with `wixEcomFrontend.openSideCart()`. * > * > 3. Test your changes to make sure your code behaves as expected. * * Shows the Mini Cart. * * The `showMiniCart()` function displays the Mini Cart. * Learn more about the [Mini Cart](https://support.wix.com/en/article/customizing-the-cart-page). * > **Note:** This API will fail when viewing the site on mobile because there is no Mini Cart on the mobile site. */ export function showMiniCart(): Promise; /** * **Deprecated.** * This function will continue to work, but a newer version is available at * [`wix-ecom-backend.currentCart.updateCurrentCartLineItemQuantity()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/update-current-cart-line-item-quantity). * * > #### 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.updateCurrentCartLineItemQuantity()`](https://dev.wix.com/docs/velo/api-reference/wix-ecom-backend/current-cart/update-current-cart-line-item-quantity). * > * > To migrate to the new function: * > * > 1. Add the new import statement: * > * > ```javascript * > import { currentCart } from "wix-ecom-backend"; * > ``` * > * > 2. Look for any code that uses `cart.updateLineItemQuantity()`, * > and replace it with `currentCart.updateCurrentCartLineItemQuantity()`. * > Update your code to work with the new `currentCart.updateCurrentCartLineItemQuantity()` * > call and response properties. * * Updates the quantity of a specified line item in the cart. * * The `updateLineItemQuantity()` function returns a Promise that resolves to the current * site visitor's cart when the specified line item's quantity has been updated. * * > **Note:** When [editing a site as a contributor](https://support.wix.com/en/article/velo-working-with-contributors), `updateLineItemQuantity()` will only work when viewing the live site. * @param cartLineItemId - ID of the cart line item to update. * @requiredField cartLineItemId * @param quantity - Line item's new quantity. * @requiredField quantity * @returns Fulfilled - The updated cart. * @servicePath wix-stores-frontend.CartObj */ export function updateLineItemQuantity(cartLineItemId: number, quantity: number): Promise;