diff --git a/src/_data/toc/graphql.yml b/src/_data/toc/graphql.yml index a6a825c826e..875bc1760d2 100644 --- a/src/_data/toc/graphql.yml +++ b/src/_data/toc/graphql.yml @@ -82,7 +82,11 @@ pages: url: /graphql/queries/company.html edition: b2b-only exclude_versions: ["2.3"] - + + - label: compareList query + url: /graphql/queries/compare-list.html + exclude_versions: ["2.3"] + - label: countries query url: /graphql/queries/directory-countries.html @@ -181,6 +185,10 @@ pages: - label: addDownloadableProductsToCart mutation url: /graphql/mutations/add-downloadable-products.html + - label: addProductsToCompareList mutation + url: /graphql/mutations/add-products-to-compare-list.html + exclude_versions: ["2.3"] + - label: addProductsToRequisitionList mutation url: /graphql/mutations/add-products-to-requisition-list.html edition: b2b-only @@ -227,6 +235,10 @@ pages: url: /graphql/mutations/apply-store-credit.html edition: ee-only + - label: assignCompareListToCustomer mutation + url: /graphql/mutations/assign-compare-list-to-customer.html + exclude_versions: ["2.3"] + - label: changeCustomerPassword mutation url: /graphql/mutations/change-customer-password.html @@ -268,6 +280,10 @@ pages: edition: b2b-only exclude_versions: ["2.3"] + - label: createCompareList mutation + url: /graphql/mutations/create-compare-list.html + exclude_versions: [ "2.3" ] + - label: createCustomer mutation url: /graphql/mutations/create-customer.html @@ -320,6 +336,10 @@ pages: edition: b2b-only exclude_versions: ["2.3"] + - label: deleteCompareList mutation + url: /graphql/mutations/delete-compare-list.html + exclude_versions: [ "2.3" ] + - label: deleteCustomerAddress mutation url: /graphql/mutations/delete-customer-address.html @@ -371,6 +391,10 @@ pages: url: /graphql/mutations/redeem-giftcard-balance.html edition: ee-only + - label: removeProductsFromCompareList mutation + url: /graphql/mutations/remove-products-from-compare-list.html + exclude_versions: ["2.3"] + - label: removeCouponFromCart mutation url: /graphql/mutations/remove-coupon.html diff --git a/src/_includes/graphql/compare-list-output.md b/src/_includes/graphql/compare-list-output.md new file mode 100644 index 00000000000..bbaba3d473b --- /dev/null +++ b/src/_includes/graphql/compare-list-output.md @@ -0,0 +1,34 @@ +Attribute | Data Type | Description +--- | --- | --- +`attributes` | [[ComparableAttribute]](#comparableAttributeObjectOutput) | An array of attributes that can be used for comparing products +`item_count` | Int! | The number of items in the compare lists +`items` | [[ComparableItem]](#comparableItemObjectOutput) | An array of products to compare +`uid` | ID! | The unique ID of a `CompareList` object + +### ComparableAttribute object {#comparableAttributeObjectOutput} + +The `ComparableAttribute` object outputs attributes which available to comparison: + +Attribute | Data Type | Description +--- | --- | --- +`code` | String! | An attribute code that is enabled for product comparisons +`label` | String! | The label of the attribute code. + +### ComparableItem object {#comparableItemObjectOutput} + +The `ComparableItem` object outputs items that have been added to compare list: + +Attribute | Data Type | Description +--- | --- | --- +`attributes` | [[ProductAttribute]!](#productAttributeObjectOutput) | An array of product attributes that can be used to compare products +`product` | [ProductInterface!]({{ page.baseurl }}/graphql/interfaces/product-interface.html) | Contains details about a product in a compare list +`uid` | ID! | The unique ID of a `ComparableItem` object + +### ProductAttribute object {#productAttributeObjectOutput} + +The `ProductAttribute` object outputs item data from the corresponding attribute: + +Attribute | Data Type | Description +--- | --- | --- +`code` | String! | The unique identifier for a product attribute code +`label` | String! | The display value of the attribute diff --git a/src/_includes/graphql/customer-output-24.md b/src/_includes/graphql/customer-output-24.md index 282b0304627..c5d12fe8ab3 100644 --- a/src/_includes/graphql/customer-output-24.md +++ b/src/_includes/graphql/customer-output-24.md @@ -1,4 +1,5 @@ {% if page.url contains 'graphql/queries/customer.html' %} +{% assign comparelist_text = " '[CompareList](#CompareList)' %} {% assign customeraddress_text = '[CustomerAddress](#customerAddressOutput)' %} {% assign customeroutput_text = '[CustomerOrders](#customerOrders)' %} {% assign crossref_text = '. See [`orders` input attributes](#orders) for details' %} @@ -6,6 +7,7 @@ {% assign rewardpoints_text = '[RewardPoints](#RewardPoints)' %} {% assign wishlist_text = '[Wishlist](#Wishlist)!' %} {% else %} +{% assign comparelist_text = 'CompareList' %} {% assign customeraddress_text = 'CustomerAddress' %} {% assign customeroutput_text = '[CustomerOrders]' %} {% assign crossref_text = '' %} @@ -18,6 +20,7 @@ Attribute | Data Type | Description --- | --- | --- `addresses` | {{ customeraddress_text }} | An array containing the customer's shipping and billing addresses `allow_remote_shopping_assistance` | Boolean! | Indicates whether the customer has enabled remote shopping assistance +`compare_list` | CompareList | The contents of the customer's compare list `created_at` | String | Timestamp indicating when the account was created `date_of_birth` | String | The customer's date of birth. In keeping with current security and privacy best practices, be sure you are aware of any potential legal and security risks associated with the storage of customers’ full date of birth (month, day, year) along with other personal identifiers, such as full name, before collecting or processing such data. `default_billing` | String | The ID assigned to the billing address diff --git a/src/guides/v2.4/graphql/mutations/add-products-to-compare-list.md b/src/guides/v2.4/graphql/mutations/add-products-to-compare-list.md new file mode 100644 index 00000000000..f6bf3865a26 --- /dev/null +++ b/src/guides/v2.4/graphql/mutations/add-products-to-compare-list.md @@ -0,0 +1,156 @@ +--- +group: graphql +title: addProductsToCompareList mutation +contributor_name: Atwix +contributor_link: https://www.atwix.com/ +--- + +The `addProductsToCompareList` mutation adds products to the comparison list. + +You must specify the unique ID of the compare list as well as a list of product IDs to be added to the comparison list. + +## Syntax + +```graphql +mutation { + addProductsToCompareList( + input: AddProductsToCompareListInput + ) { + CompareList + } +} +``` + +## Example usage + +The following example shows how to add two products into the existing comparison list with unique ID "sssXyGZkTFksdPnxNoK1ut6OiV4bbchD". + +**Request:** + +```graphql +mutation { + addProductsToCompareList( + input: { + uid: "sssXyGZkTFksdPnxNoK1ut6OiV4bbchD", + products: ["3", "4"] + } + ) { + uid + item_count + attributes { + code + label + } + items { + uid + product { + sku + name + description { + html + } + } + } + } +} +``` + +**Response:** + +```json +{ + "data": { + "addProductsToCompareList": { + "uid": "sssXyGZkTFksdPnxNoK1ut6OiV4bbchD", + "item_count": 4, + "attributes": [ + { + "code": "sku", + "label": "SKU" + }, + { + "code": "description", + "label": "Description" + }, + { + "code": "short_description", + "label": "Short Description" + }, + { + "code": "activity", + "label": "Activity" + } + ], + "items": [ + { + "uid": "1", + "product": { + "sku": "24-MB01", + "name": "Joust Duffle Bag", + "description": { + "html": "

The sporty Joust Duffle Bag can't be beat - not in the gym, not on the luggage carousel, not anywhere. Big enough to haul a basketball or soccer ball and some sneakers with plenty of room to spare, it's ideal for athletes with places to go.

\n

" + } + } + }, + { + "uid": "2", + "product": { + "sku": "24-MB04", + "name": "Strive Shoulder Pack", + "description": { + "html": "

Convenience is next to nothing when your day is crammed with action. So whether you're heading to class, gym, or the unbeaten path, make sure you've got your Strive Shoulder Pack stuffed with all your essentials, and extras as well.

\n" + } + } + }, + { + "uid": "3", + "product": { + "sku": "24-MB03", + "name": "Crown Summit Backpack", + "description": { + "html": "

The Crown Summit Backpack is equally at home in a gym locker, study cube or a pup tent, so be sure yours is packed with books, a bag lunch, water bottles, yoga block, laptop, or whatever else you want in hand. Rugged enough for day hikes and camping trips, it has two large zippered compartments and padded, adjustable shoulder straps.

\n