Newer Version Available
CommerceCart Class
Namespace
CommerceCart Methods
addItemToCart(webstoreId, effectiveAccountId, activeCartOrId, cartItemInput, currencyIsoCode)
API Version
57.0
Available to Guest Users
57.0
Requires Chatter
No
Signature
public static ConnectApi.CartItem addItemToCart(String webstoreId, String effectiveAccountId, String activeCartOrId, ConnectApi.CartItemInput cartItemInput, String currencyIsoCode)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value indicates a cart with a status that isn’t Closed or PendingDelete.
- cartItemInput
- Type: ConnectApi.CartItemInput
- A ConnectApi.CartItemInput object representing an item to add to the cart.
- currencyIsoCode
- Type: String
- The currency ISO code of the cart.
Return Value
Type: ConnectApi.CartItem
Usage
Buyers with read access to carts can add, update, and delete items in carts.
This method respects buyer View Product entitlements and only users entitled to view product data can access it.
addItemsToCart(webstoreId, effectiveAccountId, activeCartOrId, cartItems)
API Version
49.0
Available to Guest Users
54.0
Requires Chatter
No
Signature
public static ConnectApi.BatchResult[] addItemsToCart(String webstoreId, String effectiveAccountId, String activeCartOrId, List<ConnectApi.BatchInput> cartItems)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- cartItems
- Type: List<ConnectApi.BatchInput>
- The list can contain up to 100 ConnectApi.BatchInput objects. In the ConnectApi.BatchInput constructor, the input object must be ConnectApi.CartItemInput.
Return Value
Type: ConnectApi.BatchResult[]
The ConnectApi.BatchResult.getResult() method returns a ConnectApi.CartItem object.
The returned objects correspond to each of the input objects and are returned in the same order as the input objects.
The method call fails only if an error occurs that affects the entire operation (such as a parsing failure). If an individual object causes an error, the error is embedded within the ConnectApi.BatchResult list.
addItemsToCart(webstoreId, effectiveAccountId, activeCartOrId, cartItems, currencyIsoCode)
API Version
57.0
Available to Guest Users
57.0
Requires Chatter
No
Signature
public static ConnectApi.BatchResult[] addItemsToCart(String webstoreId, String effectiveAccountId, String activeCartOrId, List<ConnectApi.BatchInput> cartItems, String currencyIsoCode)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- cartItems
- Type: List<ConnectApi.BatchInput>
- The list can contain up to 100 ConnectApi.BatchInput objects. In the ConnectApi.BatchInput constructor, the input object must be ConnectApi.CartItemInput.
- currencyIsoCode
- Type: String
- The currency ISO code of the cart.
Return Value
Type: ConnectApi.BatchResult[]
The ConnectApi.BatchResult.getResult() method returns a ConnectApi.CartItem object.
The returned objects correspond to each of the input objects and are returned in the same order as the input objects.
The method call fails only if an error occurs that affects the entire operation (such as a parsing failure). If an individual object causes an error, the error is embedded within the ConnectApi.BatchResult list.
addItemToCart(webstoreId, effectiveAccountId, activeCartOrId, cartItemInput)
API Version
49.0
Available to Guest Users
54.0
Requires Chatter
No
Signature
public static ConnectApi.CartItem addItemToCart(String webstoreId, String effectiveAccountId, String activeCartOrId, ConnectApi.CartItemInput cartItemInput)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- cartItemInput
- Type: ConnectApi.CartItemInput
- A ConnectApi.CartItemInput object representing an item to add to the cart.
Return Value
Type: ConnectApi.CartItem
Usage
Buyers with read access to carts can add, update, and delete items in carts.
This method respects buyer View Product entitlements and only users entitled to view product data can access it.
applyCartCoupon(webstoreId, effectiveAccountId, activeCartOrId, cartCouponInput)
API Version
54.0
Available to Guest Users
57.0
Requires Chatter
No
Signature
public static ConnectApi.CartCouponCollection applyCartCoupon(String webstoreId, String effectiveAccountId, String activeCartOrId, ConnectApi.cartCouponInput cartCouponInput)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- cartCouponInput
- Type: ConnectApi.cartCouponInput
- Coupon code for the coupon.
Return Value
applyCartCoupon(webstoreId, effectiveAccountId, activeCartOrId, cartCouponInput, currencyIsoCode)
API Version
57.0
Available to Guest Users
57.0
Requires Chatter
No
Signature
public static ConnectApi.CartCouponCollection applyCartCoupon(String webstoreId, String effectiveAccountId, String activeCartOrId, ConnectApi.cartCouponInput cartCouponInput, String currencyIsoCode)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value indicates a cart with a status that isn’t Closed or PendingDelete.
- cartCouponInput
- Type: ConnectApi.cartCouponInput
- Coupon code for the coupon.
- currencyIsoCode
- Type: String
- Currency ISO code of the cart.
Return Value
copyCartToWishlist(webstoreId, effectiveAccountId, activeCartOrId, cartToWishlistInput)
API Version
50.0
Available to Guest Users
54.0
Requires Chatter
No
Signature
public static ConnectApi.CartToWishlistResult copyCartToWishlist(String webstoreId, String effectiveAccountId, String activeCartOrId, ConnectApi.CartToWishlistInput cartToWishlistInput)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- cartToWishlistInput
- Type: ConnectApi.CartToWishlistInput
- A ConnectApi.CartToWishlistInput object indicating the wishlist to copy products to.
Return Value
calculateCart(webstoreId, activeCartOrId, effectiveAccountId)
API Version
62.0
Available to Guest Users
62.0
Requires Chatter
No
Signature
public static ConnectApi.CalculateCartResult calculateCart(String webstoreId, String activeCartOrId, String effectiveAccountId)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value indicates a cart with a status that isn’t Closed or PendingDelete.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
Return Value
createCart(webstoreId, cart)
API Version
49.0
Available to Guest Users
54.0
Requires Chatter
No
Signature
public static ConnectApi.CartSummary createCart(String webstoreId, ConnectApi.CartInput cart)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- cart
- Type: ConnectApi.CartInput
- A ConnectApi.CartInput object representing a cart.
Return Value
Type: ConnectApi.CartSummary
cloneCart(webstoreId, activeCartOrId, targetEffectiveAccountId, targetType)
API Version
60.0
Available to Guest Users
60.0
Requires Chatter
No
Signature
public static ConnectApi.CartSummary cloneCart(String webstoreId, String activeCartOrId, String targetEffectiveAccountId, String targetType)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- targetEffectiveAccountId
- Type: String
- Effective Account ID associated with the cloned cart.
- targetType
- Type: String
- Type of the cloned cart. Value is PayNowReadOnly.
Return Value
Type: ConnectApi.CartSummary
Usage
The cloneCart method is valid only for the Pay Now feature. See Salesforce Pay Now for Embedded Payment Solutions.
deleteCart(webstoreId, effectiveAccountId, activeCartOrId)
API Version
49.0
Available to Guest Users
54.0
Requires Chatter
No
Signature
public static Void deleteCart(String webstoreId, String effectiveAccountId, String activeCartOrId)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
Return Value
Type: Void
Usage
Buyers with read access to carts can create and delete carts.
deleteCartCoupon(webstoreId, effectiveAccountId, activeCartOrId, cartCouponId)
API Version
54.0
Available to Guest Users
57.0
Requires Chatter
No
Signature
public static Void deleteCartCoupon(String webstoreId, String effectiveAccountId, String activeCartOrId, String cartCouponId)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- cartCouponId
- Type: String
- ID of the cart coupon.
Return Value
Type: Void
deleteCartCoupon(webstoreId, effectiveAccountId, activeCartOrId, cartCouponId, currencyIsoCode)
API Version
57.0
Available to Guest Users
57.0
Requires Chatter
No
Signature
public static Void deleteCartCoupon(String webstoreId, String effectiveAccountId, String activeCartOrId, String cartCouponId, String currencyIsoCode)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value indicates a cart with a status that isn’t Closed or PendingDelete.
- cartCouponId
- Type: String
- ID of the cart coupon.
- currencyIsoCode
- Type: String
- Currency ISO code of the cart.
Return Value
Type: Void
deleteCartItem(webstoreId, effectiveAccountId, activeCartOrId, cartItemId)
API Version
49.0
Available to Guest Users
54.0
Requires Chatter
No
Signature
public static Void deleteCartItem(String webstoreId, String effectiveAccountId, String activeCartOrId, String cartItemId)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- cartItemId
- Type: String
- ID of the cart item.
Return Value
Type: Void
Usage
Buyers with read access to carts can add, update, and delete items in carts.
deleteInventoryReservation(webstoreId, activeCartOrId, effectiveAccountId) (Pilot)
API Version
58.0
Available to Guest Users
58.0
Requires Chatter
No
Signature
public static Void deleteInventoryReservation(String webstoreId, String activeCartOrId, String effectiveAccountId)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value indicates a cart with a status that isn’t Closed or PendingDelete.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
Return Value
Type: Void
getCartCoupons(webstoreId, effectiveAccountId, activeCartOrId)
API Version
54.0
Available to Guest Users
57.0
Requires Chatter
No
Signature
public static ConnectApi.CartCouponCollection getCartCoupons(String webstoreId, String effectiveAccountId, String activeCartOrId)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
Return Value
getCartCoupons(webstoreId, effectiveAccountId, activeCartOrId, currencyIsoCode)
API Version
57.0
Available to Guest Users
57.0
Requires Chatter
No
Signature
public static ConnectApi.CartCouponCollection getCartCoupons(String webstoreId, String effectiveAccountId, String activeCartOrId, String currencyIsoCode)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value indicates a cart with a status that isn’t Closed or PendingDelete.
Return Value
getCartItemPromotion(webstoreId, effectiveAccountId, activeCartOrId, cartItemPromotionCollectionInput)
API Version
52.0
Available to Guest Users
57.0
Requires Chatter
No
Signature
public static ConnectApi.CartItemPromotionCollectionOutputRepresentation getCartItemPromotion(String webstoreId, String effectiveAccountId, String activeCartOrId, ConnectApi.CartItemPromotionCollectionInputRepresentation cartItemPromotionCollectionInput)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value indicates a cart with a status that isn’t Closed or PendingDelete.
- cartItemPromotionCollectionInput
- Type: ConnectApi.CartItemPromotionCollectionInputRepresentation
- Promotions for a cart item.
Return Value
Type: ConnectApi.CartItemPromotionCollectionOutputRepresentation
getCartItemPromotion(webstoreId, effectiveAccountId, activeCartOrId, cartItemPromotionCollectionInput, currencyIsoCode)
API Version
57.0
Available to Guest Users
57.0
Requires Chatter
No
Signature
public static ConnectApi.CartItemPromotionCollectionOutputRepresentation getCartItemPromotion(String webstoreId, String effectiveAccountId, String activeCartOrId, ConnectApi.CartItemPromotionCollectionInputRepresentation cartItemPromotionCollectionInput, String currencyIsoCode)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value indicates a cart with a status that isn’t Closed or PendingDelete.
- cartItemPromotionCollectionInput
- Type: ConnectApi.CartItemPromotionCollectionInputRepresentation
- Promotions for a cart item.
- currencyIsoCode
- Type: String
- Currency ISO code of the cart.
Return Value
Type: ConnectApi.CartItemPromotionCollectionOutputRepresentation
getCartItems(webstoreId, effectiveAccountId, activeCartOrId)
API Version
49.0
Available to Guest Users
54.0
Requires Chatter
No
Signature
public static ConnectApi.CartItemCollection getCartItems(String webstoreId, String effectiveAccountId, String activeCartOrId)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
Return Value
getCartItems(webstoreId, effectiveAccountId, activeCartOrId, pageParam)
API Version
49.0
Available to Guest Users
54.0
Requires Chatter
No
Signature
public static ConnectApi.CartItemCollection getCartItems(String webstoreId, String effectiveAccountId, String activeCartOrId, String pageParam)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- pageParam
- Type: String
- Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.
Return Value
getCartItems(webstoreId, effectiveAccountId, activeCartOrId, pageParam, sortParam)
API Version
49.0
Available to Guest Users
54.0
Requires Chatter
No
Signature
public static ConnectApi.CartItemCollection getCartItems(String webstoreId, String effectiveAccountId, String activeCartOrId, String pageParam, ConnectApi.CartItemSortOrder sortParam)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- pageParam
- Type: String
- Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.
- sortParam
- Type: ConnectApi.CartItemSortOrder
- Sort order for items in a cart.
Values are:
- CreatedDateAsc—Sorts by oldest creation date.
- CreatedDateDesc—Sorts by most recent creation date.
- NameAsc—Sorts by name in ascending alphabetical order (A–Z).
- NameDesc—Sorts by name in descending alphabetical order (Z–A).
- SalesPriceAsc—Sorts from lowest to highest negotiated price.
- SalesPriceDesc—Sorts from highest to lowest negotiated price.
Return Value
getCartItems(webstoreId, effectiveAccountId, activeCartOrId, pageParam, pageSize)
API Version
49.0
Available to Guest Users
54.0
Requires Chatter
No
Signature
public static ConnectApi.CartItemCollection getCartItems(String webstoreId, String effectiveAccountId, String activeCartOrId, String pageParam, Integer pageSize)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- pageParam
- Type: String
- Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.
- pageSize
- Type: Integer
- Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.
Return Value
getCartItems(webstoreId, effectiveAccountId, activeCartOrId, pageParam, pageSize, sortParam)
API Version
49.0
Available to Guest Users
54.0
Requires Chatter
No
Signature
public static ConnectApi.CartItemCollection getCartItems(String webstoreId, String effectiveAccountId, String activeCartOrId, String pageParam, Integer pageSize, ConnectApi.CartItemSortOrder sortParam)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- pageParam
- Type: String
- Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.
- pageSize
- Type: Integer
- Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.
- sortParam
- Type: ConnectApi.CartItemSortOrder
- Sort order for items in a cart.
Values are:
- CreatedDateAsc—Sorts by oldest creation date.
- CreatedDateDesc—Sorts by most recent creation date.
- NameAsc—Sorts by name in ascending alphabetical order (A–Z).
- NameDesc—Sorts by name in descending alphabetical order (Z–A).
- SalesPriceAsc—Sorts from lowest to highest negotiated price.
- SalesPriceDesc—Sorts from highest to lowest negotiated price.
Return Value
getCartItems(webstoreId, effectiveAccountId, activeCartOrId, productFields, pageParam, pageSize, sortParam)
API Version
49.0
Available to Guest Users
54.0
Requires Chatter
No
Signature
public static ConnectApi.CartItemCollection getCartItems(String webstoreId, String effectiveAccountId, String activeCartOrId, String productFields, String pageParam, Integer pageSize, ConnectApi.CartItemSortOrder sortParam)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- productFields
- Type: String
- Comma-separated list of up to 15 product fields. Results include fields that you have access to. Some product fields (such as productName and sku) are returned even when not included in the productFields parameter.
- pageParam
- Type: String
- Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.
- pageSize
- Type: Integer
- Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.
- sortParam
- Type: ConnectApi.CartItemSortOrder
- Sort order for items in a cart.
Values are:
- CreatedDateAsc—Sorts by oldest creation date.
- CreatedDateDesc—Sorts by most recent creation date.
- NameAsc—Sorts by name in ascending alphabetical order (A–Z).
- NameDesc—Sorts by name in descending alphabetical order (Z–A).
- SalesPriceAsc—Sorts from lowest to highest negotiated price.
- SalesPriceDesc—Sorts from highest to lowest negotiated price.
Return Value
getCartItems(webstoreId, effectiveAccountId, activeCartOrId, productFields, pageParam, pageSize, sortParam, currencyIsoCode)
API Version
57.0
Available to Guest Users
57.0
Requires Chatter
No
Signature
public static ConnectApi.CartItemCollection getCartItems(String webstoreId, String effectiveAccountId, String activeCartOrId, String productFields, String pageParam, Integer pageSize, ConnectApi.CartItemSortOrder sortParam, String currencyIsoCode)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- productFields
- Type: String
- Comma-separated list of up to 15 product fields. Results include fields that you have access to. Some product fields (such as productName and sku) are returned even when not included in the productFields parameter.
- pageParam
- Type: String
- Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.
- pageSize
- Type: Integer
- Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.
- currencyIsoCode
- Type: String
- Currency ISO code of the cart.
Return Value
getCartItems(webstoreId, effectiveAccountId, activeCartOrId, productFields, pageParam, pageSize, sortParam, currencyIsoCode, includePromotions, includeCoupons)
API Version
59.0
Available to Guest Users
54.0
Requires Chatter
No
Signature
public static ConnectApi.CartItemCollection getCartItems(String webstoreId, String effectiveAccountId, String activeCartOrId, String productFields, String pageParam, Integer pageSize, ConnectApi.CartItemSortOrder sortParam, String currencyIsoCode, Boolean includePromotions, Boolean includeCoupons)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- productFields
- Type: String
- Comma-separated list of up to 15 product fields. Results include fields that you have access to. Some product fields (such as productName and sku) are returned even when not included in the productFields parameter.
- pageParam
- Type: String
- Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.
- pageSize
- Type: Integer
- Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.
Return Value
getCartItems(webstoreId, effectiveAccountId, activeCartOrId, productFields, pageParam, pageSize, sortParam, currencyIsoCode, includePromotions, includeCoupons, pageNumber)
API Version
60.0
Available to Guest Users
54.0
Requires Chatter
No
Signature
public static ConnectApi.CartItemCollection getCartItems(String webstoreId, String effectiveAccountId, String activeCartOrId, String productFields, String pageParam, Integer pageSize, ConnectApi.CartItemSortOrder sortParam, String currencyIsoCode, Boolean includePromotions, Boolean includeCoupons, Integer pageNumber)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- productFields
- Type: String
- Comma-separated list of up to 15 product fields. Results include fields that you have access to. Some product fields (such as productName and sku) are returned even when not included in the productFields parameter.
- pageParam
- Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.
- Description
- pageSize
- Type: Integer
- Specifies the number of items per page. Valid values are from 1 through 100. If you pass in null, the default size is 25.
- sortParam
- Type: ConnectApi.CartItemSortOrder
- Sort order for items in a cart.
Values are:
- CreatedDateAsc—Sorts by oldest creation date.
- CreatedDateDesc—Sorts by most recent creation date.
- NameAsc—Sorts by name in ascending alphabetical order (A–Z).
- NameDesc—Sorts by name in descending alphabetical order (Z–A).
- SalesPriceAsc—Sorts from lowest to highest negotiated price.
- SalesPriceDesc—Sorts from highest to lowest negotiated price.
- includePromotions
- Type: Boolean
- Indicates whether to include coupons (True) or not (False)
- includeCoupons
- Type: Boolean
- Indicates whether to include promotions (True) or not (False).
- pageNumber
- Type: Integer
- Specifies the requested page number.
Return Value
getCartPromotions(webstoreId, effectiveAccountId, activeCartOrId)
API Version
53.0
Available to Guest Users
57.0
Requires Chatter
No
Signature
public static ConnectApi.CartPromotionCollection getCartPromotions(String webstoreId, String effectiveAccountId, String activeCartOrId)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value indicates a cart with a status that isn’t Closed or PendingDelete.
Return Value
getCartPromotions(webstoreId, effectiveAccountId, activeCartOrId, currencyIsoCode)
API Version
57.0
Available to Guest Users
57.0
Requires Chatter
No
Signature
public static ConnectApi.CartPromotionCollection getCartPromotions(String webstoreId, String effectiveAccountId, String activeCartOrId, String currencyIsoCode)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value indicates a cart with a status that isn’t Closed or PendingDelete.
- currencyIsoCode
- Type: String
- Currency ISO code of the cart.
Return Value
getCartSummary(webstoreId, effectiveAccountId, activeCartOrId)
API Version
49.0
Available to Guest Users
54.0
Requires Chatter
No
Signature
public static ConnectApi.CartSummary getCartSummary(String webstoreId, String effectiveAccountId, String activeCartOrId)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete. If you specify active and there isn’t an active cart, you get an error.
Return Value
Type: ConnectApi.CartSummary
getCartSummary(webstoreId, effectiveAccountId, activeCartOrId, currencyIsoCode)
API Version
57.0
Available to Guest Users
57.0
Requires Chatter
No
Signature
public static ConnectApi.CartSummary getCartSummary(String webstoreId, String effectiveAccountId, String activeCartOrId, String currencyIsoCode)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete. If you specify active and there isn’t an active cart, you get an error.
- currencyIsoCode
- Type: String
- Currency ISO code of the cart.
Return Value
Type: ConnectApi.CartSummary
getOrCreateActiveCartSummary(webstoreId, effectiveAccountId, activeCartOrId)
API Version
49.0
Available to Guest Users
54.0
Requires Chatter
No
Signature
public static ConnectApi.CartSummary getOrCreateActiveCartSummary(String webstoreId, String effectiveAccountId, String activeCartOrId)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete. If you specify active and there isn’t an active cart, one is created.
Return Value
Type: ConnectApi.CartSummary
Usage
Buyers with read access to carts can create and delete carts.
getOrCreateActiveCartSummary(webstoreId, effectiveAccountId, activeCartOrId, currencyIsoCode)
API Version
57.0
Available to Guest Users
57.0
Requires Chatter
No
Signature
public static ConnectApi.CartSummary getOrCreateActiveCartSummary(String webstoreId, String effectiveAccountId, String activeCartOrId, String currencyIsoCode)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete. If you specify active and there isn’t an active cart, one is created.
- currencyIsoCode
- Type: String
- Currency ISO code of the cart.
Return Value
Type: ConnectApi.CartSummary
Usage
Buyers with read access to carts can create and delete carts.
getProductCartItem(webstoreId, effectiveAccountId, activeCartOrId, productId, currencyIsoCode)
API Version
60.0
Available to Guest Users
60.0
Requires Chatter
No
Signature
public static ConnectApi.ProductCartItem getProductCartItem(String webstoreId, String effectiveAccountId, String activeCartOrId, String productId, String currencyIsoCode)
Parameters
Return Value
getProductCartItems(webstoreId, effectiveAccountId, activeCartOrId, pageSize, pageNumber, currencyIsoCode)
API Version
60.0
Available to Guest Users
60.0
Requires Chatter
No
Signature
public static ConnectApi.ProductCartItemCollection getProductCartItems(String webstoreId, String effectiveAccountId, String activeCartOrId, Integer pageSize, Integer pageNumber, String currencyIsoCode)
Parameters
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If unspecified, the default value is determined from context.
- pageSize
- Type: Integer
- Specifies the number of items per page. Valid values are from 1 through 100. If you don’t specify a value, the default size is 25.
- pageNumber
- Type: Integer
- Specifies the requested page number.
- currencyIsoCode
- Type: String
- Currency ISO code of the cart.
Return Value
makeCartPrimary(webstoreId, activeCartOrId, effectiveAccountId)
API Version
53.0
Available to Guest Users
56.0
Requires Chatter
Yes
Signature
public static ConnectApi.CommerceActionResult makeCartPrimary(String webstoreId, String activeCartOrId, String effectiveAccountId)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
Return Value
preserveGuestCart(webstoreId, effectiveAccountId, activeCartOrId, currencyIsoCode)
API Version
60.0
Requires Chatter
No
Signature
public static ConnectApi.PreserveCart preserveGuestCart(String webstoreId, String effectiveAccountId, String activeCartOrId, String currencyIsoCode)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- currencyIsoCode
- Type: String
- The currency ISO code of the cart.
Return Value
Type: ConnectApi.PreserveCart
setCartMessagesVisibility(webstoreId, activeCartOrId, effectiveAccountId, messageVisibility)
API Version
50.0
Available to Guest Users
54.0
Requires Chatter
No
Signature
public static ConnectApi.CartMessagesVisibilityResult setCartMessagesVisibility(String webstoreId, String activeCartOrId, String effectiveAccountId, ConnectApi.CartMessagesVisibilityInput messageVisibility)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- messageVisibility
- Type: ConnectApi.CartMessagesVisibilityInput
- A ConnectApi.CartMessagesVisibilityInput object specifying the visibility setting.
Return Value
updateCartItem(webstoreId, effectiveAccountId, activeCartOrId, cartItemId, cartItem)
API Version
49.0
Available to Guest Users
54.0
Requires Chatter
No
Signature
public static ConnectApi.CartItem updateCartItem(String webstoreId, String effectiveAccountId, String activeCartOrId, String cartItemId, ConnectApi.CartItemInput cartItem)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- cartItemId
- Type: String
- ID of the cart item.
- cartItem
- Type: ConnectApi.CartItemInput
- A ConnectApi.CartItemInput object representing a cart item to update.
Return Value
Type: ConnectApi.CartItem
Usage
Buyers with read access to carts can add, update, and delete items in carts.
This method respects buyer View Product entitlements and only users entitled to view product data can access it.
updateCartItem(webstoreId, effectiveAccountId, activeCartOrId, cartItemId, cartItem, currencyIsoCode)
API Version
57.0
Available to Guest Users
57.0
Requires Chatter
No
Signature
public static ConnectApi.CartItem updateCartItem(String webstoreId, String effectiveAccountId, String activeCartOrId, String cartItemId, ConnectApi.CartItemInput cartItem, String currencyIsoCode)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value is available in version 50.0 and later and indicates a cart with a status that isn’t Closed or PendingDelete.
- cartItemId
- Type: String
- ID of the cart item.
- cartItem
- Type: ConnectApi.CartItemInput
- A ConnectApi.CartItemInput object representing a cart item to update.
- currencyIsoCode
- Type: String
- The currency ISO code of the cart.
Return Value
Type: ConnectApi.CartItem
Usage
Buyers with read access to carts can add, update, and delete items in carts.
This method respects buyer View Product entitlements and only users entitled to view product data can access it.
upsertInventoryReservation(webstoreId, activeCartOrId, effectiveAccountId, cartInventoryReservationInput) (Pilot)
API Version
58.0
Available to Guest Users
58.0
Requires Chatter
No
Signature
public static ConnectApi.CartInventoryReservationOutputRepresentation upsertInventoryReservation(String webstoreId, String activeCartOrId, String effectiveAccountId, ConnectApi.CartInventoryReservationInputRepresentation cartInventoryReservationInput)
Parameters
- webstoreId
- Type: String
- ID of the webstore.
- activeCartOrId
- Type: String
- ID of the cart, active, or current. The current value indicates a cart with a status that isn’t Closed or PendingDelete.
- effectiveAccountId
- Type: String
- ID of the buyer account or guest buyer profile for which the request is made. If null, the default value is determined from context.
- cartInventoryReservationInput
- Type: ConnectApi.CartInventoryReservationInputRepresentation
- A ConnectApi.CartInventoryReservationInputRepresentation input class indicating the reservation duration.
Return Value
Type: ConnectApi.CartInventoryReservationOutputRepresentation