removeProductsFromWishlist mutation
The removeProductsFromWishlist
mutation completely removes the specified items from the customer’s wish list. Use the updateProductsInWishlist
mutation to change the quantity of specific items in the wish list.
This mutation requires a valid customer authentication token.
Syntax
1
2
3
4
5
6
7
8
mutation {
removeProductsFromWishlist(
wishlistId: ID!
wishlistItemsIds: [ID!]!
) {
RemoveProductsFromWishlistOutput
}
}
Example usage
The following example removes an item that was added in the addProductsToWishlist
mutation example.
Request:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
mutation {
removeProductsFromWishlist(
wishlistId: 4
wishlistItemsIds: [
26
]){
wishlist {
id
items_count
items_v2 {
items {
id
quantity
product {
uid
name
sku
price_range {
minimum_price {
regular_price {
currency
value
}
}
maximum_price {
regular_price {
currency
value
}
}
}
}
}
}
}
user_errors {
code
message
}
}
}
Response:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{
"data": {
"removeProductsFromWishlist": {
"wishlist": {
"id": "4",
"items_count": 2,
"items_v2": {
"items": [
{
"id": "27",
"quantity": 1,
"product": {
"uid": "MTIyNg==",
"name": "Stellar Solar Jacket",
"sku": "WJ01",
"price_range": {
"minimum_price": {
"regular_price": {
"currency": "USD",
"value": 75
}
},
"maximum_price": {
"regular_price": {
"currency": "USD",
"value": 75
}
}
}
}
},
{
"id": "28",
"quantity": 1,
"product": {
"uid": "NTI=",
"name": "Sprite Yoga Companion Kit",
"sku": "24-WG080",
"price_range": {
"minimum_price": {
"regular_price": {
"currency": "USD",
"value": 61
}
},
"maximum_price": {
"regular_price": {
"currency": "USD",
"value": 77
}
}
}
}
}
]
}
},
"user_errors": []
}
}
}
Input attributes
The removeProductsFromWishlist
mutation requires the following input.
Attribute | Data Type | Description |
---|---|---|
wishlistId |
ID! | The ID of the customer’s wish list |
wishlistItemsIds |
[ID!]! | An array of wish list item IDs to be removed |
Output attributes
The RemoveProductsFromWishlistOutput
object contains the customer’s wish list and error message information.
Attribute | Data Type | Description |
---|---|---|
user_errors |
[WishListUserInputError!]! | An array of errors encountered while adding products to a wish list |
wishlist |
Wishlist! | Contains the wish list with all items that were successfully added |
Wishlist attributes
The Wishlist
object contains all the items in the customer’s wish list.
Attribute | Data type | Description |
---|---|---|
id |
ID | The unique ID of a Wishlist object |
items |
[WishlistItem] | Deprecated. Use items_v2 instead |
items_v2 |
[WishlistItemInterface] | An array of items in the customer’s wish list |
items_count |
Int | The number of items in the wish list |
name |
String | The wish list name. Applicable to Adobe Commerce only |
sharing_code |
String | An encrypted code that Magento uses to link to the wish list |
updated_at |
String | The time of the last modification to the wish list |
visibility |
WishlistVisibilityEnum! | An enum indicating whether the wish list is PUBLIC or PRIVATE. Applicable to Adobe Commerce only |
WishlistItem attributes
The WishlistItem
object can contain the following attributes.
Attribute | Data type | Description |
---|---|---|
added_at |
String | The time when the customer added the item to the wish list |
description |
String | The customer’s comment about this item |
id |
Int | The wish list item ID |
product |
ProductInterface | The ProductInterface contains attributes that are common to all types of products. Note that descriptions may not be available for custom and EAV attributes |
qty |
Float | The quantity of this wish list item |
WishListUserInputError attributes
The WishListUserInputError
object contains information about errors that are specific to wish lists.
Attribute | Data Type | Description |
---|---|---|
code |
WishListUserInputErrorType! | A wish list-specific error code. Possible values include PRODUCT_NOT_FOUND and UNDEFINED |
message |
String! | A localized error message |
Errors
Error | Description |
---|---|
The current user cannot perform operations on wishlist |
An unauthorized user (guest) tried to add an item to a wishlist, or an authorized user (customer) tried to add an item to a wishlist of another customer. |
The wishlist was not found. |
The value provided in the wishlistId field is invalid or does not exist for the customer. |