Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

CommerceWishlist Class

Get, create, update, and delete wishlists. Add wishlists to carts. Get wishlist items, add items to wishlists, and delete wishlist items.

Namespace

ConnectApi

CommerceWishlist Methods

These methods are for CommerceWishlist. All methods are static.

addItemToWishlist(webstoreId, wishlistId, wishlistItemInput)

Add an item to a wishlist for the context user.

API Version

49.0

Requires Chatter

No

Signature

public static ConnectApi.WishlistItem addItemToWishlist(String webstoreId, String wishlistId, ConnectApi.WishlistItemInput wishlistItemInput)

Parameters

webstoreId
Type: String
ID of the webstore.
wishlistId
Type: String
ID of the wishlist.
wishlistItemInput
Type: ConnectApi.WishlistItemInput
A ConnectApi.WishlistItemInput body with the item to add to the wishlist.

Return Value

Type: ConnectApi.WishlistItem

Usage

This method respects buyer View Product entitlements and only users entitled to view product data can access it.

addItemToWishlist(webstoreId, effectiveAccountId, wishlistId, wishlistItemInput)

Add an item to a wishlist.

API Version

49.0

Requires Chatter

No

Signature

public static ConnectApi.WishlistItem addItemToWishlist(String webstoreId, String effectiveAccountId, String wishlistId, ConnectApi.WishlistItemInput wishlistItemInput)

Parameters

webstoreId
Type: String
ID of the webstore.
effectiveAccountId
Type: String
ID of the account for which the request is made.If null, defaults to the account ID for the context user.
wishlistId
Type: String
ID of the wishlist.
wishlistItemInput
Type: ConnectApi.WishlistItemInput
A ConnectApi.WishlistItemInput body with the item to add to the wishlist.

Return Value

Type: ConnectApi.WishlistItem

Usage

This method respects buyer View Product entitlements and only users entitled to view product data can access it.

addWishlistToCart(webstoreId, wishlistId)

Add a wishlist to the active cart for the context user.

API Version

49.0

Requires Chatter

No

Signature

public static ConnectApi.WishlistToCartResult addWishlistToCart(String webstoreId, String wishlistId)

Parameters

webstoreId
Type: String
ID of the webstore.
wishlistId
Type: String
ID of the wishlist.

Return Value

Type: ConnectApi.WishlistToCartResult

Usage

This method respects buyer View Product entitlements and only users entitled to view product data can access it.

addWishlistToCart(webstoreId, wishlistId, effectiveAccountId)

Add a wishlist to the active cart.

API Version

49.0

Requires Chatter

No

Signature

public static ConnectApi.WishlistToCartResult addWishlistToCart(String webstoreId, String wishlistId, String effectiveAccountId)

Parameters

webstoreId
Type: String
ID of the webstore.
wishlistId
Type: String
ID of the wishlist.
effectiveAccountId
Type: String
ID of the account for which the request is made.If null, defaults to the account ID for the context user.

Return Value

Type: ConnectApi.WishlistToCartResult

Usage

This method respects buyer View Product entitlements and only users entitled to view product data can access it.

addWishlistToCartWithCartId(webstoreId, wishlistId, cartId)

Add a wishlist to a cart.

API Version

49.0

Requires Chatter

No

Signature

public static ConnectApi.WishlistToCartResult addWishlistToCartWithCartId(String webstoreId, String wishlistId, String cartId)

Parameters

webstoreId
Type: String
ID of the webstore.
wishlistId
Type: String
ID of the wishlist.
cartId
Type: String
ID of the cart. If null, wishlist items are added to the active cart.

Return Value

Type: ConnectApi.WishlistToCartResult

Usage

This method respects buyer View Product entitlements and only users entitled to view product data can access it.

addWishlistToCartWithCartId(webstoreId, wishlistId, cartId, effectiveAccountId)

Add a wishlist to a cart.

API Version

49.0

Requires Chatter

No

Signature

public static ConnectApi.WishlistToCartResult addWishlistToCartWithCartId(String webstoreId, String wishlistId, String cartId, String effectiveAccountId)

Parameters

webstoreId
Type: String
ID of the webstore.
wishlistId
Type: String
ID of the wishlist.
cartId
Type: String
ID of the cart. If null, wishlist items are added to the active cart.
effectiveAccountId
Type: String
ID of the account for which the request is made.If null, defaults to the account ID for the context user.

Return Value

Type: ConnectApi.WishlistToCartResult

Usage

This method respects buyer View Product entitlements and only users entitled to view product data can access it.

createWishlist(webstoreId, wishlistInput)

Create a wishlist for the context user.

API Version

49.0

Requires Chatter

No

Signature

public static ConnectApi.Wishlist createWishlist(String webstoreId, ConnectApi.WishlistInput wishlistInput)

Parameters

webstoreId
Type: String
ID of the webstore.
wishlistInput
Type: ConnectApi.WishlistInput
A ConnectApi.WishlistInput body that includes the wishlist name and items.

Return Value

Type: ConnectApi.Wishlist

createWishlist(webstoreId, effectiveAccountId, wishlistInput)

Create a wishlist.

API Version

49.0

Requires Chatter

No

Signature

public static ConnectApi.Wishlist createWishlist(String webstoreId, String effectiveAccountId, ConnectApi.WishlistInput wishlistInput)

Parameters

webstoreId
Type: String
ID of the webstore.
effectiveAccountId
Type: String
ID of the account for which the request is made.If null, defaults to the account ID for the context user.
wishlistInput
Type: ConnectApi.WishlistInput
A ConnectApi.WishlistInput body that includes the wishlist name and items.

Return Value

Type: ConnectApi.Wishlist

deleteWishlist(webstoreId, wishlistId)

Delete a wishlist for the context user.

API Version

49.0

Requires Chatter

No

Signature

public static Void deleteWishlist(String webstoreId, String wishlistId)

Parameters

webstoreId
Type: String
ID of the webstore.
wishlistId
Type: String
ID of the wishlist.

Return Value

Type: Void

deleteWishlist(webstoreId, effectiveAccountId, wishlistId)

Delete a wishlist.

API Version

51.0

Requires Chatter

No

Signature

public static Void deleteWishlist(String webstoreId, String effectiveAccountId, String wishlistId)

Parameters

webstoreId
Type: String
ID of the webstore.
effectiveAccountId
Type: String
ID of the account for which the request is made.If null, defaults to the account ID for the context user.
wishlistId
Type: String
ID of the wishlist.

Return Value

Type: Void

getWishlist(webstoreId, effectiveAccountId, wishlistId, productFields, sortItemsBy)

Get a wishlist with product fields sorted by items.

API Version

51.0

Requires Chatter

No

Signature

public static ConnectApi.Wishlist getWishlist(String webstoreId, String effectiveAccountId, String wishlistId, String productFields, ConnectApi.WishlistItemSortOrder sortItemsBy)

Parameters

webstoreId

Type: String

ID of the webstore.

effectiveAccountId

Type: String

ID of the account for which the request is made.If null, defaults to the account ID for the context user.

wishlistId

Type: String

ID of the wishlist.

productFields

Type: String

Comma-separated list of custom product fields. Fields aren’t case-sensitive. For example, ProductCode and productcode return the same results.

sortItemsBy

Type: ConnectApi.WishlistItemSortOrder

Sort order for wishlist items. Values are:

  • CreatedDateAsc—Sorts by oldest creation date.
  • CreatedDateDesc—Sorts by most recent creation date.

The default sort order is CreatedDateDesc.

Return Value

Type: ConnectApi.Wishlist

getWishlist(webstoreId, effectiveAccountId, wishlistId, productFields, pageSize, sortItemsBy)

Get a wishlist with product fields sorted by items with a specified number of items per page.

API Version

51.0

Requires Chatter

No

Signature

public static ConnectApi.Wishlist getWishlist(String webstoreId, String effectiveAccountId, String wishlistId, String productFields, Integer pageSize, ConnectApi.WishlistItemSortOrder sortItemsBy)

Parameters

webstoreId

Type: String

ID of the webstore.

effectiveAccountId

Type: String

ID of the account for which the request is made.If null, defaults to the account ID for the context user.

wishlistId

Type: String

ID of the wishlist.

productFields

Type: String

Comma-separated list of custom product fields. Fields aren’t case-sensitive. For example, ProductCode and productcode return the same results.

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.

sortItemsBy

Type: ConnectApi.WishlistItemSortOrder

Sort order for wishlist items. Values are:

  • CreatedDateAsc—Sorts by oldest creation date.
  • CreatedDateDesc—Sorts by most recent creation date.

The default sort order is CreatedDateDesc.

Return Value

Type: ConnectApi.Wishlist

getWishlistItems(webstoreId, effectiveAccountId, wishlistId, productFields, pageParam, sortItemsBy)

Get a page of sorted wishlist items with product fields.

API Version

51.0

Requires Chatter

No

Signature

public static ConnectApi.WishlistItemCollection getWishlistItems(String webstoreId, String effectiveAccountId, String wishlistId, String productFields, String pageParam, ConnectApi.WishlistItemSortOrder sortItemsBy)

Parameters

webstoreId

Type: String

ID of the webstore.

effectiveAccountId

Type: String

ID of the account for which the request is made.If null, defaults to the account ID for the context user.

wishlistId

Type: String

ID of the wishlist.

productFields

Type: String

Comma-separated list of custom product fields. Fields aren’t case-sensitive. For example, ProductCode and productcode return the same results.

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.

sortItemsBy

Type: ConnectApi.WishlistItemSortOrder

Sort order for wishlist items. Values are:

  • CreatedDateAsc—Sorts by oldest creation date.
  • CreatedDateDesc—Sorts by most recent creation date.

The default sort order is CreatedDateDesc.

getWishlistItems(webstoreId, effectiveAccountId, wishlistId, productFields, pageParam, pageSize, sortItemsBy)

Get a page of specified size of sorted wishlist items with product fields.

API Version

51.0

Requires Chatter

No

Signature

public static ConnectApi.WishlistItemCollection getWishlistItems(String webstoreId, String effectiveAccountId, String wishlistId, String productFields, String pageParam, Integer pageSize, ConnectApi.WishlistItemSortOrder sortItemsBy)

Parameters

webstoreId

Type: String

ID of the webstore.

effectiveAccountId

Type: String

ID of the account for which the request is made. If null, defaults to the account ID for the context user.

wishlistId

Type: String

ID of the wishlist.

productFields

Type: String

Comma-separated list of custom product fields. Fields aren’t case-sensitive. For example, ProductCode and productcode return the same results.

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 200. If you pass in null, the default size is 25.

sortItemsBy

Type: ConnectApi.WishlistItemSortOrder

Sort order for wishlist items. Values are:

  • CreatedDateAsc—Sorts by oldest creation date.
  • CreatedDateDesc—Sorts by most recent creation date.

The default sort order is CreatedDateDesc.

getWishlistSummaries(webstoreId, effectiveAccountId, includeDisplayedList)

Get wishlist summaries.

API Version

49.0

Requires Chatter

No

Signature

public static ConnectApi.WishlistsSummary getWishlistSummaries(String webstoreId, String effectiveAccountId, Boolean includeDisplayedList)

Parameters

webstoreId
Type: String
ID of the webstore.
effectiveAccountId
Type: String
ID of the account for which the request is made.If null, defaults to the account ID for the context user.
includeDisplayedList
Type: Boolean
Specifies whether to include the displayed list (true) or not (false). If null, defaults to false.

Return Value

Type: ConnectApi.WishlistsSummary

getWishlistSummaries(webstoreId, effectiveAccountId, includeDisplayedList, productFields, sortItemsBy)

Get wishlist summaries with product fields sorted by items.

API Version

51.0

Requires Chatter

No

Signature

public static ConnectApi.WishlistsSummary getWishlistSummaries(String webstoreId, String effectiveAccountId, Boolean includeDisplayedList, String productFields, ConnectApi.WishlistItemSortOrder sortItemsBy)

Parameters

webstoreId

Type: String

ID of the webstore.

effectiveAccountId

Type: String

ID of the account for which the request is made.If null, defaults to the account ID for the context user.

includeDisplayedList

Type: Boolean

Specifies whether to include the displayed list (true) or not (false).

productFields

Type: String

Comma-separated list of custom product fields. Fields aren’t case-sensitive. For example, ProductCode and productcode return the same results.

If includeDisplayedList is false, productFields is ignored.

sortItemsBy

Type: ConnectApi.WishlistItemSortOrder

Sort order for wishlist items. Values are:

  • CreatedDateAsc—Sorts by oldest creation date.
  • CreatedDateDesc—Sorts by most recent creation date.

The default sort order is CreatedDateDesc.

If includeDisplayedList is false, sortItemsBy is ignored.

Return Value

Type: ConnectApi.WishlistsSummary

getWishlistSummaries(webstoreId, effectiveAccountId, includeDisplayedList, productFields, pageSize, sortItemsBy)

Get wishlist summaries with product fields sorted by items with a specified number of items per page.

API Version

51.0

Requires Chatter

No

Signature

public static ConnectApi.WishlistsSummary getWishlistSummaries(String webstoreId, String effectiveAccountId, Boolean includeDisplayedList, Integer pageSize, String productFields, pageSize, ConnectApi.WishlistItemSortOrder sortItemsBy)

Parameters

webstoreId

Type: String

ID of the webstore.

effectiveAccountId

Type: String

ID of the account for which the request is made.If null, defaults to the account ID for the context user.

includeDisplayedList

Type: Boolean

Specifies whether to include the displayed list (true) or not (false).

productFields

Type: String

Comma-separated list of custom product fields. Fields aren’t case-sensitive. For example, ProductCode and productcode return the same results.

If includeDisplayedList is false, productFields is ignored.

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.

sortItemsBy

Type: ConnectApi.WishlistItemSortOrder

Sort order for wishlist items. Values are:

  • CreatedDateAsc—Sorts by oldest creation date.
  • CreatedDateDesc—Sorts by most recent creation date.

The default sort order is CreatedDateDesc.

If includeDisplayedList is false, sortItemsBy is ignored.

Return Value

Type: ConnectApi.WishlistsSummary

removeWishlistItem(webstoreId, effectiveAccountId, wishlistId, wishlistItemId)

Remove an item from a wishlist.

API Version

49.0

Requires Chatter

No

Signature

public static Void removeWishlistItem(String webstoreId, String effectiveAccountId, String wishlistId, String wishlistItemId)

Parameters

webstoreId
Type: String
ID of the webstore.
effectiveAccountId
Type: String
ID of the account for which the request is made.If null, defaults to the account ID for the context user.
wishlistId
Type: String
ID of the wishlist.
wishlistItemId
Type: String
ID of the wishlist item to remove.

Return Value

Type: Void

updateWishlist(webstoreId, wishlistId, wishlistUpdateInput)

Update the name of a wishlist for the context user.

API Version

50.0

Requires Chatter

No

Signature

public static ConnectApi.WishlistSummary updateWishlist(String webstoreId, String wishlistId, ConnectApi.WishlistUpdateInput wishlistUpdateInput)

Parameters

webstoreId
Type: String
ID of the webstore.
wishlistId
Type: String
ID of the wishlist.
wishlistUpdateInput
Type: ConnectApi.WishlistUpdateInput
A ConnectApi.WishlistUpdateInput body with the wishlist name to update.

Return Value

Type: ConnectApi.WishlistSummary

updateWishlist(webstoreId, effectiveAccountId, wishlistId, wishlistUpdateInput)

Update the name of a wishlist.

API Version

50.0

Requires Chatter

No

Signature

public static ConnectApi.WishlistSummary updateWishlist(String webstoreId, String effectiveAccountId, String wishlistId, ConnectApi.WishlistUpdateInput wishlistUpdateInput)

Parameters

webstoreId
Type: String
ID of the webstore.
effectiveAccountId
Type: String
ID of the account for which the request is made.If null, defaults to the account ID for the context user.
wishlistId
Type: String
ID of the wishlist.
wishlistUpdateInput
Type: ConnectApi.WishlistUpdateInput
A ConnectApi.WishlistUpdateInput body with the wishlist name to update.

Return Value

Type: ConnectApi.WishlistSummary