Skip to main content
Version: 2.0.0

WishlistMutation

Description

Wishlist operations are grouped in one source class and exposed as three GraphQL mutations:

  • addToWishlist
  • removeFromWishlist
  • clearWishlist

All wishlist mutations require authenticated user context.

addToWishlist

Adds a product or entry to wishlist.

Endpoint

mutation addToWishlist($id: Int, $entryId: Int, $sku: String, $wishlistId: Int) {
addToWishlist(id: $id, entryId: $entryId, sku: $sku, wishlistId: $wishlistId) {
success
message
items {
id
entry_id
name
added_at
}
}
}

Arguments

ArgumentTypeRequiredDescription
idIntNoProduct element ID (used when wishlist identifier mode is id).
entryIdIntNoCraft entry ID to resolve product from entry relation flow.
skuStringNoProduct SKU/handle (used when wishlist identifier mode is sku).
wishlistIdIntNoSpecific wishlist ID when multiple wishlists are supported.

removeFromWishlist

Removes one wishlist item by item ID.

Endpoint

mutation removeFromWishlist($wishlistItemId: Int!) {
removeFromWishlist(wishlistItemId: $wishlistItemId) {
success
message
items {
id
entry_id
name
}
}
}

clearWishlist

Clears all wishlist items for the authenticated user.

Endpoint

mutation clearWishlist {
clearWishlist {
success
message
items {
id
entry_id
name
}
}
}

Return Values

All three operations return WishlistType:

FieldTypeDescription
successBooleanMutation result state.
messageStringResult message.
items[WishlistItemType]Current wishlist snapshot after mutation.

Notes

  • addToWishlist accepts multiple identification strategies; plugin setting gqlWishlistProductIdentifier decides whether id or sku is required.
  • If entryId is provided, plugin resolves an entry first and adds related product to wishlist.
  • After every wishlist mutation, returned items can be used to update UI without separate query call.