updateProductsInWishlist mutation

The updateProductsInWishlist mutation changes the quantity, description and option information for the specified items in the customer’s wish list.

Use the removeProductsFromWishlist mutation to remove an item from the wish list. Do not set the quantity of an item to 0.

This mutation requires a valid customer authentication token.

Syntax

1
2
3
4
5
6
7
8
mutation {
  updateProductsInWishlist(
    wishlistId: ID!
    wishlistItems: [WishlistItemUpdateInput!]!
  ){
      UpdateProductsInWishlistOutput
  }
}

Example usage

The following example changes the quantity of the product represented by wish list item 16 to 2 and adds a description for item 17.

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
42
43
44
45
46
47
48
mutation {
  updateProductsInWishlist(
  wishlistId: 2
  wishlistItems: [
    {
      wishlist_item_id: 10
      quantity: 2
    }
    {
      wishlist_item_id: 11
      description: "I love this!"
    }
  ]){
    wishlist {
      id
      items_count
      items_v2 {
        items {
          id
          quantity
          product {
            name
            sku
            uid
            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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
{
  "data": {
    "updateProductsInWishlist": {
      "wishlist": {
        "id": "2",
        "items_count": 8,
        "items_v2": {
          "items": [
            {
              "id": "8",
              "quantity": 1,
              "product": {
                "name": "Advanced Pilates & Yoga (Strength)",
                "sku": "240-LV08",
                "uid": "NDk=",
                "price_range": {
                  "minimum_price": {
                    "regular_price": {
                      "currency": "USD",
                      "value": 18
                    }
                  },
                  "maximum_price": {
                    "regular_price": {
                      "currency": "USD",
                      "value": 18
                    }
                  }
                }
              }
            },
            {
              "id": "10",
              "quantity": 1,
              "product": {
                "name": "Layla Tee",
                "sku": "WS04",
                "uid": "MTQ1MA==",
                "price_range": {
                  "minimum_price": {
                    "regular_price": {
                      "currency": "USD",
                      "value": 29
                    }
                  },
                  "maximum_price": {
                    "regular_price": {
                      "currency": "USD",
                      "value": 29
                    }
                  }
                }
              }
            },
            {
              "id": "11",
              "quantity": 1,
              "product": {
                "name": "Radiant Tee",
                "sku": "WS12",
                "uid": "MTU2Mg==",
                "price_range": {
                  "minimum_price": {
                    "regular_price": {
                      "currency": "USD",
                      "value": 22
                    }
                  },
                  "maximum_price": {
                    "regular_price": {
                      "currency": "USD",
                      "value": 22
                    }
                  }
                }
              }
            },
            {
              "id": "12",
              "quantity": 1,
              "product": {
                "name": "Electra Bra Top",
                "sku": "WB01",
                "uid": "MTYxMA==",
                "price_range": {
                  "minimum_price": {
                    "regular_price": {
                      "currency": "USD",
                      "value": 39
                    }
                  },
                  "maximum_price": {
                    "regular_price": {
                      "currency": "USD",
                      "value": 39
                    }
                  }
                }
              }
            },
            {
              "id": "13",
              "quantity": 1,
              "product": {
                "name": "Celeste Sports Bra",
                "sku": "WB03",
                "uid": "MTY0Mg==",
                "price_range": {
                  "minimum_price": {
                    "regular_price": {
                      "currency": "USD",
                      "value": 39
                    }
                  },
                  "maximum_price": {
                    "regular_price": {
                      "currency": "USD",
                      "value": 39
                    }
                  }
                }
              }
            },
            {
              "id": "15",
              "quantity": 2,
              "product": {
                "name": "Nora Practice Tank",
                "sku": "WT03",
                "uid": "MTcyMg==",
                "price_range": {
                  "minimum_price": {
                    "regular_price": {
                      "currency": "USD",
                      "value": 39
                    }
                  },
                  "maximum_price": {
                    "regular_price": {
                      "currency": "USD",
                      "value": 39
                    }
                  }
                }
              }
            },
            {
              "id": "24",
              "quantity": 2,
              "product": {
                "name": "Layla Tee",
                "sku": "WS04",
                "uid": "MTQ1MA==",
                "price_range": {
                  "minimum_price": {
                    "regular_price": {
                      "currency": "USD",
                      "value": 29
                    }
                  },
                  "maximum_price": {
                    "regular_price": {
                      "currency": "USD",
                      "value": 29
                    }
                  }
                }
              }
            },
            {
              "id": "25",
              "quantity": 1,
              "product": {
                "name": "Radiant Tee",
                "sku": "WS12",
                "uid": "MTU2Mg==",
                "price_range": {
                  "minimum_price": {
                    "regular_price": {
                      "currency": "USD",
                      "value": 22
                    }
                  },
                  "maximum_price": {
                    "regular_price": {
                      "currency": "USD",
                      "value": 22
                    }
                  }
                }
              }
            }
          ]
        }
      },
      "user_errors": []
    }
  }
}

Input attributes

The updateProductsInWishlist mutation requires the following input.

Attribute Data Type Description
wishlistId ID! The ID of the customer’s wish list
wishlistItems [WishlistItemUpdateInput!]! An array containing products to be updated

WishlistItemUpdateInput attributes

The WishlistItemUpdateInput object defines each item to add to the wish list.

Attribute Data Type Description
description String Customer-entered comments about the item
entered_options [EnteredOptionInput] An array of options that the customer entered
quantity Float The amount or number of items to add
selected_options [ID!] An array of strings corresponding to options the customer selected
wishlist_item_id ID! The ID of the wishlist item to update

EnteredOptionInput attributes

The EnteredOptionInput object must contain the following attributes.

Attribute Data Type Description
uid ID! The unique ID for a specific CustomizableOptionInterface object, such as a CustomizableFieldOption, CustomizableFileOption, or CustomizableAreaOption object
value String! Text the customer entered

Output attributes

The UpdateProductsInWishlistOutput 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 provifed in the wishlistId field is invalid or does not exist for the customer.