Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit c7f4841

Browse files
authored
GraphQL: Document WishlistItemInterface (#8221)
* GraphQL: Document WishlistItemInterface * checkpoint * Rename/update mutations * checkpoint * Update examples and descriptions * fix linting errors * I have to save my changes. Who knew? * Incorporate dev feedback * linting * fix merge conflict
1 parent cbf0181 commit c7f4841

16 files changed

+1270
-765
lines changed

src/_data/toc/graphql.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ pages:
210210
- label: changeCustomerPassword mutation
211211
url: /graphql/mutations/change-customer-password.html
212212

213-
- label: copyProductsToWishlist mutation
214-
url: /graphql/mutations/copy-products-to-wishlist.html
213+
- label: copyProductsBetweenWishlists mutation
214+
url: /graphql/mutations/copy-products-between-wishlists.html
215215
edition: ee-only
216216
exclude_versions: ["2.3"]
217217

@@ -319,8 +319,8 @@ pages:
319319
- label: mergeCarts mutation
320320
url: /graphql/mutations/merge-carts.html
321321

322-
- label: moveProductsToWishlist mutation
323-
url: /graphql/mutations/move-products-to-wishlist.html
322+
- label: moveProductsBetweenWishlists mutation
323+
url: /graphql/mutations/move-products-between-wishlists.html
324324
edition: ee-only
325325
exclude_versions: ["2.3"]
326326

@@ -509,6 +509,10 @@ pages:
509509
url: /graphql/interfaces/shipment-item-interface.html
510510
exclude_versions: ["2.3"]
511511

512+
- label: WishlistItemInterface attributes and implementations
513+
url: /graphql/interfaces/wishlist-item-interface.html
514+
exclude_versions: ["2.3"]
515+
512516
- label: Payment methods
513517
children:
514518

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
The `WishlistItemInterface` contains the following attributes.
2+
3+
Attribute | Data type | Description
4+
--- | --- | ---
5+
`added_at` | String! | The date and time the item was added to the wish list
6+
`customizable_options`| [SelectedCustomizableOption] | Custom options selected for the wish list item
7+
`description`| String | The description of the item
8+
`id`| ID! | The ID of the wish list item
9+
`product` | [ProductInterface]({{page.baseurl}}/graphql/interfaces/product-interface.html) | Product details of the wish list item
10+
`quantity`| Float! | The quantity of this wish list item

src/_includes/graphql/wishlist.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ The `Wishlist` object contains all the items in the customer's wish list.
22

33
Attribute | Data type | Description
44
--- | --- | ---
5-
`id` | ID | The unique identifier of the wish list
6-
`items` | [[WishlistItem](#WishlistItem)] | An array of items in the customer's wish list
5+
`id` | ID | The unique ID of a `Wishlist` object
6+
`items` | [[WishlistItem](#WishlistItem)] | Deprecated. Use `items_v2` instead
7+
`items_v2` | [[WishlistItemInterface]]({{page.baseurl/graphql/interfaces/wishlist-item/interface.html}}) | An array of items in the customer's wish list
78
`items_count` | Int | The number of items in the wish list
9+
`name` | String | The wish list name. Applicable to {{site.data.var.ee}} only
810
`sharing_code` | String | An encrypted code that Magento uses to link to the wish list
911
`updated_at` | String | The time of the last modification to the wish list
12+
`visibility` | WishlistVisibilityEnum! | An enum indicating whether the wish list is PUBLIC or PRIVATE. Applicable to {{site.data.var.ee}} only
1013

1114
#### WishlistItem attributes {#WishlistItem}
1215

@@ -17,5 +20,5 @@ Attribute | Data type | Description
1720
`added_at` | String | The time when the customer added the item to the wish list
1821
`description` | String | The customer's comment about this item
1922
`id` | Int | The wish list item ID
20-
`product` | [ProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html) | The ProductInterface contains attributes that are common to all types of products. Note that descriptions may not be available for custom and EAV attributes
21-
`qty` | Float | The quantity of this wish list item
23+
`product` | [ProductInterface]({{page.baseurl}}/graphql/interfaces/product-interface.html) | The ProductInterface contains attributes that are common to all types of products. Note that descriptions may not be available for custom and EAV attributes
24+
`qty` | Float | The quantity of this wish list item
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
---
2+
group: graphql
3+
title: WishlistItemInterface attributes and implementations
4+
---
5+
6+
`WishlistItemInterface` provides details about items in a wish list. It has the following implementations:
7+
8+
* [`BundleWishlistItem`](#BundleWishlistItem)
9+
* [`ConfigurableWishlistItem`](#ConfigurableWishlistItem)
10+
* [`DownloadableWishlistItem`](#DownloadableWishlistItem)
11+
* [`GiftCardWishlistItem`](#GiftCardWishlistItem)
12+
* [`GroupedProductWishlistItem`](#GroupedProductWishlistItem)
13+
* [`SimpleWishlistItem`](#SimpleWishlistItem)
14+
* [`VirtualWishlistItem`](#VirtualWishlistItem)
15+
16+
## Attributes
17+
18+
{% include graphql/wishlist-item-interface.md %}
19+
20+
## Implementations
21+
22+
### BundleWishlistItem attributes {#BundleWishlistItem}
23+
24+
The `BundleWishlistItem` object defines the following bundle-product specific attribute:
25+
26+
Attribute | Data type | Description
27+
--- | --- | ---
28+
`bundle_options` | [SelectedBundleOption!]| An array containing information about the selected bundle items
29+
30+
### ConfigurableWishlistItem attributes {#ConfigurableWishlistItem}
31+
32+
The `ConfigurableWishlistItem` object defines the following attributes that are specific to configurable products:
33+
34+
Attribute | Data type | Description
35+
--- | --- | ---
36+
`child_sku` | String! | The SKU of the simple product corresponding to a set of selected configurable options
37+
`configurable_options` | [SelectedConfigurableOption!] | An array of selected configurable options
38+
39+
### DownloadableWishlistItem attributes {#DownloadableWishlistItem}
40+
41+
The `DownloadableWishlistItem` object defines the following attributes that are specific to downloadable products:
42+
43+
Attribute | Data type | Description
44+
--- | --- | ---
45+
`links_v2` | [DownloadableProductLinks] | An array containing information about the selected links
46+
`samples` | [DownloadableProductSamples] | An array containing information about the selected samples
47+
48+
### GiftCardWishlistItem attributes {#GiftCardWishlistItem}
49+
50+
The `GiftCardWishlistItem` object defines the following gift card-specific attribute:
51+
52+
Attribute | Data type | Description
53+
--- | --- | ---
54+
`gift_card_options` | GiftCardOptions! | Contains details about a gift card product
55+
56+
#### GiftCardOptions attributes {#GiftCardOptions}
57+
58+
The GiftCardOptions object provides details about a gift card. All attributes are optional for a wish list.
59+
60+
Attribute | Data type | Description
61+
--- | --- | ---
62+
`amount` | Money | The amount and currency of the gift card
63+
`custom_giftcard_amount` | Money | The custom amount and currency of the gift card
64+
`message` | String | A message to the recipient
65+
`recipient_email` | String | The email of the person receiving the gift card
66+
`recipient_name` | String | The name of the person receiving the gift card
67+
`sender_email` | String | The email of the sender
68+
`sender_name` | String | The name of the sender
69+
70+
### GroupedProductWishlistItem attributes {#GroupedProductWishlistItem}
71+
72+
The GroupedProductWishlistItem data type does not provide additional attributes to the `WishlistItemInterface`.
73+
74+
### SimpleWishlistItem attributes {#SimpleWishlistItem}
75+
76+
The SimpleWishlistItem data type does not provide additional attributes to the `WishlistItemInterface`.
77+
78+
### VirtualWishlistItem attributes {#VirtualWishlistItem}
79+
80+
The VirtualWishlistItem data type does not provide additional attributes to the `WishlistItemInterface`.
81+
82+
## Example usage
83+
84+
The following mutation adds a downloadable product to a wish list and returns detailed information about the product.
85+
86+
**Request:**
87+
88+
```graphql
89+
mutation {
90+
addProductsToWishlist(
91+
wishlistId: 3,
92+
wishlistItems: [
93+
{
94+
sku: "240-LV06"
95+
quantity: 1
96+
}
97+
]
98+
) {
99+
user_errors {
100+
code
101+
message
102+
}
103+
wishlist {
104+
id
105+
sharing_code
106+
items_count
107+
updated_at
108+
items_v2 {
109+
uid
110+
quantity
111+
added_at
112+
... on DownloadableWishlistItem {
113+
links_v2 {
114+
uid
115+
title
116+
sample_url
117+
}
118+
samples {
119+
title
120+
sample_url
121+
}
122+
}
123+
}
124+
}
125+
}
126+
}
127+
```
128+
**Response:**
129+
130+
```json
131+
{
132+
"data": {
133+
"addProductsToWishlist": {
134+
"user_errors": [],
135+
"wishlist": {
136+
"id": "3",
137+
"sharing_code": "cVeOljNmNKm0e1jRFj7PRMyBXrpu88Sf",
138+
"items_count": 1,
139+
"updated_at": "2020-11-12 03:01:46",
140+
"items_v2": [
141+
{
142+
"uid": "MTQ=",
143+
"quantity": 1,
144+
"added_at": "2020-11-12 03:01:46",
145+
"links_v2": [
146+
{
147+
"uid": "ZG93bmxvYWRhYmxlLzM=",
148+
"title": "Yoga Adventure",
149+
"sample_url": "http://example.com/downloadable/download/linkSample/link_id/3/"
150+
}
151+
],
152+
"samples": [
153+
{
154+
"title": "Trailer #1",
155+
"sample_url": "http://example.com/downloadable/download/sample/sample_id/7/"
156+
},
157+
{
158+
"title": "Trailer #2",
159+
"sample_url": "http://example.com/downloadable/download/sample/sample_id/8/"
160+
},
161+
{
162+
"title": "Trailer #3",
163+
"sample_url": "http://example.com/downloadable/download/sample/sample_id/9/"
164+
}
165+
]
166+
}
167+
]
168+
}
169+
}
170+
}
171+
}
172+
```

0 commit comments

Comments
 (0)