|
| 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