The Current Cart API provides functionality for managing the current site visitor's cart and creating a checkout based on the current cart.

A cart object is created whenever a product or service is added to the current cart, or the cart.createCart() function is called.

The cart is the first phase of an eCommerce purchase flow, followed by checkout, then order. A cart holds information about items for purchase, prices, discounts, site details, and more.

The Current Cart API differs from the Cart API in that there is no need for a cart._id to manage it. All methods in the Current Cart API automatically interact with the site visitor's cart that is currently being used.

To see an estimate of the current cart's totals (including shipping costs) use the estimateCurrentCartTotals() function.

To create a checkout based on the current site visitor's cart, use the createCheckoutFromCurrentCart() function.

Before you begin

To assist in moving from the soon-to-be deprecated Stores Cart API to the eCommerce Cart API, refer to the Cart Conversion Table. Other than the cartId, cart and current cart objects are identical.

To use the Wix eCommerce Current Cart API, import { currentCart } from the wix-ecom-backend module:

Was this helpful?