Setup

To use the CurrentCart API, install the @wix/ecom package using npm or Yarn:

Copy
1
npm install @wix/ecom

or

Copy
1
yarn add @wix/ecom

Then import { currentCart } from @wix/ecom:

Copy
1
import { currentCart } from '@wix/ecom'
Was this helpful?
Yes
No

addToCurrentCart( )

Adds catalog line items to the current site visitor's cart.

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

Note: When adding catalog items, options.lineItems.catalogReference is required.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage eCommerce - all permissions
Learn more about permission scopes.
Params
optionsAddToCurrentCartOptions
Items to be added to the current cart.
Response Object
AddToCartResponse
Was this helpful?
Yes
No

createCheckoutFromCurrentCart( )

Creates a checkout from the current cart.

The createCheckoutFromCurrentCart() function returns a Promise that resolves to the new checkout's ID when it's created.

If a checkout was already created from the current cart, that checkout will be updated with any new information from the cart.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Stores - all permissions
Manage eCommerce - all permissions
Manage Orders
Learn more about permission scopes.
Params
optionsCreateCheckoutFromCurrentCartOptions
Checkout creation options.
Response Object
CreateCheckoutResponse
Was this helpful?
Yes
No

deleteCurrentCart( )

Deletes the current site visitor's cart.

The deleteCurrentCart() function returns a Promise that resolves when the current cart is deleted.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage eCommerce - all permissions
Learn more about permission scopes.
Request
This method does not take any parameters
Response Object
void
Was this helpful?
Yes
No

estimateCurrentCartTotals( )

Estimates the current cart's price totals (including tax), based on a selected carrier service, shipping address, and billing information.

The estimateCurrentCartTotals() function returns a Promise that resolves when the estimated totals are generated.

Note: Not passing any options properties will only estimate the cart items price totals.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Stores - all permissions
Read eCommerce - all read permissions
Read Orders
Read Stores - all read permissions
Manage eCommerce - all permissions
Manage Orders
Learn more about permission scopes.
Params
optionsEstimateCurrentCartTotalsOptions
Total estimation options.
Response Object
EstimateTotalsResponse
Was this helpful?
Yes
No

getCurrentCart( )

Retrieves the current site visitor's cart.

The getCurrentCart() function returns a Promise that resolves when the current cart is retrieved.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Stores - all permissions
Read eCommerce - all read permissions
Read Orders
Read Stores - all read permissions
Manage eCommerce - all permissions
Manage Orders
Learn more about permission scopes.
Request
This method does not take any parameters
Response Object
Cart
Was this helpful?
Yes
No

removeCouponFromCurrentCart( )

Removes the coupon from the current site visitor's cart.

The removeCouponFromCurrentCart() function returns a Promise that resolves to the updated current cart when the coupon is removed.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage eCommerce - all permissions
Learn more about permission scopes.
Request
This method does not take any parameters
Response Object
RemoveCouponResponse
Was this helpful?
Yes
No

removeLineItemsFromCurrentCart( )

Removes line items from the current site visitor's cart.

The removeLineItemsFromCurrentCart() function returns a Promise that resolves to the updated current cart when the line items are removed.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage eCommerce - all permissions
Learn more about permission scopes.
Params
lineItemIdsArray<string>Required
IDs of the line items to remove from the cart.
Response Object
RemoveLineItemsResponse
Was this helpful?
Yes
No

updateCurrentCart( )

Updates the current site visitor's cart.

The updateCurrentCart() function returns a Promise that resolves when the current cart's properties are updated.

Note: When updating catalog items, options.lineItems.catalogReference is required.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage eCommerce - all permissions
Learn more about permission scopes.
Params
optionsUpdateCurrentCartOptions
Current cart update options.
Response Object
Cart
Was this helpful?
Yes
No

updateCurrentCartLineItemQuantity( )

Updates the quantity of one or more line items in the current site visitor's cart.

The updateCurrentCartLineItemQuantity() function returns a Promise that resolves when the quantities of the current cart's line items are updated. This endpoint is only for updating the quantity of line items. To entirely remove a line item from the current cart, use removeLineItemsFromCurrentCart(). To add a new line item to the current cart, use addToCurrentCart().

This endpoint checks the amount of stock remaining for this line item. If the specified quantity is greater than the remaining stock, then the quantity returned in the response is the total amount of remaining stock.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage eCommerce - all permissions
Learn more about permission scopes.
Params
lineItemsArray<LineItemQuantityUpdate>Required
Line item IDs and their new quantity.
Response Object
UpdateLineItemsQuantityResponse
Was this helpful?
Yes
No