createWishlist mutation
Magento Commerce only
The content on this page is for Magento Commerce only.
Learn more
The createWishlist
mutation creates a wish list for the logged in customer. Magento Commerce allows customers to have multiple wish lists.
This mutation requires a valid customer authentication token.
Use the storeConfig
query with the following attributes to determine whether multiple wish lists are supported:
enable_multiple_wishlists
magento_wishlist_general_is_enabled
maximum_number_of_wishlists
Syntax
1
2
3
4
5
mutation {
createWishlist(input: CreateWishlistInput!) {
CreateWishlistOutput
}
}
Example usage
The following example creates the My favorites
public wish list.
Request:
1
2
3
4
5
6
7
8
9
10
11
12
13
mutation {
createWishlist(input: {
name: "My favorites"
visibility: PUBLIC
}
) {
wishlist {
id
name
visibility
}
}
}
Response:
1
2
3
4
5
6
7
8
9
10
11
{
"data": {
"createWishlist": {
"wishlist": {
"id": "3",
"name": "My favorites",
"visibility": "PUBLIC"
}
}
}
}
Input attributes
The CreateWishlistInput
object requires the following input.
Attribute | Data Type | Description |
---|---|---|
name |
String! | The ID of the customer’s wish list |
visibility |
WishlistVisibilityEnum! | Describes the visibility of the wish list. Possible values are PRIVATE and PUBLIC |
Output attributes
The createWishlist
mutation returns the Wishlist object.
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 Magento 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 Magento 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 |