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

GraphQL: Document WishlistItemInterface #8221

Merged
merged 19 commits into from
Dec 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/_data/toc/graphql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ pages:
- label: changeCustomerPassword mutation
url: /graphql/mutations/change-customer-password.html

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

Expand Down Expand Up @@ -319,8 +319,8 @@ pages:
- label: mergeCarts mutation
url: /graphql/mutations/merge-carts.html

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

Expand Down Expand Up @@ -509,6 +509,10 @@ pages:
url: /graphql/interfaces/shipment-item-interface.html
exclude_versions: ["2.3"]

- label: WishlistItemInterface attributes and implementations
url: /graphql/interfaces/wishlist-item-interface.html
exclude_versions: ["2.3"]

- label: Payment methods
children:

Expand Down
10 changes: 10 additions & 0 deletions src/_includes/graphql/wishlist-item-interface.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
The `WishlistItemInterface` contains the following attributes.

Attribute | Data type | Description
--- | --- | ---
`added_at` | String! | The date and time the item was added to the wish list
`customizable_options`| [SelectedCustomizableOption] | Custom options selected for the wish list item
`description`| String | The description of the item
`id`| ID! | The ID of the wish list item
`product` | [ProductInterface]({{page.baseurl}}/graphql/interfaces/product-interface.html) | Product details of the wish list item
`quantity`| Float! | The quantity of this wish list item
11 changes: 7 additions & 4 deletions src/_includes/graphql/wishlist.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ The `Wishlist` object contains all the items in the customer's wish list.

Attribute | Data type | Description
--- | --- | ---
`id` | ID | The unique identifier of the wish list
`items` | [[WishlistItem](#WishlistItem)] | An array of items in the customer's wish list
`id` | ID | The unique ID of a `Wishlist` object
`items` | [[WishlistItem](#WishlistItem)] | Deprecated. Use `items_v2` instead
`items_v2` | [[WishlistItemInterface]]({{page.baseurl/graphql/interfaces/wishlist-item/interface.html}}) | 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 {{site.data.var.ee}} 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 {{site.data.var.ee}} only

#### WishlistItem attributes {#WishlistItem}

Expand All @@ -17,5 +20,5 @@ 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]({{ 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
`qty` | Float | The quantity of this wish list item
`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
`qty` | Float | The quantity of this wish list item
172 changes: 172 additions & 0 deletions src/guides/v2.4/graphql/interfaces/wishlist-item-interface.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
---
group: graphql
title: WishlistItemInterface attributes and implementations
---

`WishlistItemInterface` provides details about items in a wish list. It has the following implementations:

* [`BundleWishlistItem`](#BundleWishlistItem)
* [`ConfigurableWishlistItem`](#ConfigurableWishlistItem)
* [`DownloadableWishlistItem`](#DownloadableWishlistItem)
* [`GiftCardWishlistItem`](#GiftCardWishlistItem)
* [`GroupedProductWishlistItem`](#GroupedProductWishlistItem)
* [`SimpleWishlistItem`](#SimpleWishlistItem)
* [`VirtualWishlistItem`](#VirtualWishlistItem)

## Attributes

{% include graphql/wishlist-item-interface.md %}

## Implementations

### BundleWishlistItem attributes {#BundleWishlistItem}

The `BundleWishlistItem` object defines the following bundle-product specific attribute:

Attribute | Data type | Description
--- | --- | ---
`bundle_options` | [SelectedBundleOption!]| An array containing information about the selected bundle items

### ConfigurableWishlistItem attributes {#ConfigurableWishlistItem}

The `ConfigurableWishlistItem` object defines the following attributes that are specific to configurable products:

Attribute | Data type | Description
--- | --- | ---
`child_sku` | String! | The SKU of the simple product corresponding to a set of selected configurable options
`configurable_options` | [SelectedConfigurableOption!] | An array of selected configurable options

### DownloadableWishlistItem attributes {#DownloadableWishlistItem}

The `DownloadableWishlistItem` object defines the following attributes that are specific to downloadable products:

Attribute | Data type | Description
--- | --- | ---
`links_v2` | [DownloadableProductLinks] | An array containing information about the selected links
`samples` | [DownloadableProductSamples] | An array containing information about the selected samples

### GiftCardWishlistItem attributes {#GiftCardWishlistItem}

The `GiftCardWishlistItem` object defines the following gift card-specific attribute:

Attribute | Data type | Description
--- | --- | ---
`gift_card_options` | GiftCardOptions! | Contains details about a gift card product

#### GiftCardOptions attributes {#GiftCardOptions}

The GiftCardOptions object provides details about a gift card. All attributes are optional for a wish list.

Attribute | Data type | Description
--- | --- | ---
`amount` | Money | The amount and currency of the gift card
`custom_giftcard_amount` | Money | The custom amount and currency of the gift card
`message` | String | A message to the recipient
`recipient_email` | String | The email of the person receiving the gift card
`recipient_name` | String | The name of the person receiving the gift card
`sender_email` | String | The email of the sender
`sender_name` | String | The name of the sender

### GroupedProductWishlistItem attributes {#GroupedProductWishlistItem}

The GroupedProductWishlistItem data type does not provide additional attributes to the `WishlistItemInterface`.

### SimpleWishlistItem attributes {#SimpleWishlistItem}

The SimpleWishlistItem data type does not provide additional attributes to the `WishlistItemInterface`.

### VirtualWishlistItem attributes {#VirtualWishlistItem}

The VirtualWishlistItem data type does not provide additional attributes to the `WishlistItemInterface`.

## Example usage

The following mutation adds a downloadable product to a wish list and returns detailed information about the product.

**Request:**

```graphql
mutation {
addProductsToWishlist(
wishlistId: 3,
wishlistItems: [
{
sku: "240-LV06"
quantity: 1
}
]
) {
user_errors {
code
message
}
wishlist {
id
sharing_code
items_count
updated_at
items_v2 {
uid
quantity
added_at
... on DownloadableWishlistItem {
links_v2 {
uid
title
sample_url
}
samples {
title
sample_url
}
}
}
}
}
}
```
**Response:**

```json
{
"data": {
"addProductsToWishlist": {
"user_errors": [],
"wishlist": {
"id": "3",
"sharing_code": "cVeOljNmNKm0e1jRFj7PRMyBXrpu88Sf",
"items_count": 1,
"updated_at": "2020-11-12 03:01:46",
"items_v2": [
{
"uid": "MTQ=",
"quantity": 1,
"added_at": "2020-11-12 03:01:46",
"links_v2": [
{
"uid": "ZG93bmxvYWRhYmxlLzM=",
"title": "Yoga Adventure",
"sample_url": "http://example.com/downloadable/download/linkSample/link_id/3/"
}
],
"samples": [
{
"title": "Trailer #1",
"sample_url": "http://example.com/downloadable/download/sample/sample_id/7/"
},
{
"title": "Trailer #2",
"sample_url": "http://example.com/downloadable/download/sample/sample_id/8/"
},
{
"title": "Trailer #3",
"sample_url": "http://example.com/downloadable/download/sample/sample_id/9/"
}
]
}
]
}
}
}
}
```
Loading