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

Commit b29dcf6

Browse files
authored
GraphQL: Migrate products topics (#5265)
* checkpoint * checkpoint 2 * fix navigation * Mostly adding intro sentences before attribute tables * review comments * more review comments * fix build problems
1 parent fc44e45 commit b29dcf6

23 files changed

+551
-451
lines changed

_data/toc/graphql.yml

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ pages:
4747

4848
- label: Queries
4949
children:
50+
- label: category query
51+
url: /graphql/queries/category.html
5052

5153
- label: checkoutAgreements query
5254
url: /graphql/queries/checkout-agreements.html
@@ -72,6 +74,9 @@ pages:
7274
- label: customerOrders query
7375
url: /graphql/queries/customer-orders.html
7476

77+
- label: customerDownloadableProducts query
78+
url: /graphql/queries/customer-downloadable-products.html
79+
7580
- label: customerPaymentTokens query
7681
url: /graphql/queries/customer-payment-tokens.html
7782

@@ -81,6 +86,9 @@ pages:
8186
- label: getPayflowLinkToken query
8287
url: /graphql/queries/get-payflow-link-token.html
8388

89+
- label: products query
90+
url: /graphql/queries/products.html
91+
8492
- label: storeConfig query
8593
url: /graphql/queries/store-config.html
8694

@@ -92,6 +100,9 @@ pages:
92100

93101
- label: Mutations
94102
children:
103+
- label: addConfigurableProductsToCart mutation
104+
url: /graphql/mutations/add-configurable-products.html
105+
95106
- label: applyStoreCreditToCart mutation
96107
url: /graphql/mutations/apply-store-credit.html
97108

@@ -113,37 +124,33 @@ pages:
113124
- label: removeStoreCreditFromCart mutation
114125
url: /graphql/mutations/remove-store-credit.html
115126

116-
- label: Reference
127+
- label: Product data types and interfaces
117128
children:
118-
- label: Customer endpoint
119-
url: /graphql/reference/customer.html
129+
- label: Product interface implementations
130+
url: /graphql/product/product-interface-implementations.html
120131

121-
- label: Products endpoint
122-
url: /graphql/reference/products.html
123-
children:
124-
- label: Product interface implementations
125-
url: /graphql/reference/product-interface-implementations.html
126-
127-
- label: CustomizableOptionInterface
128-
url: /graphql/reference/customizable-option-interface.html
132+
- label: CustomizableOptionInterface
133+
url: /graphql/product/customizable-option-interface.html
129134

130-
- label: BundleProduct endpoint
131-
url: /graphql/reference/bundle-product.html
135+
- label: Bundle product data types
136+
url: /graphql/product/bundle-product.html
132137

133-
- label: Category endpoint
134-
url: /graphql/reference/categories.html
138+
- label: Configurable product data types
139+
url: /graphql/product/configurable-product.html
135140

136-
- label: ConfigurableProduct endpoint
137-
url: /graphql/reference/configurable-product.html
141+
- label: Downloadable product data types
142+
url: /graphql/product/downloadable-product.html
138143

139-
- label: DownloadableProduct endpoint
140-
url: /graphql/reference/downloadable-product.html
144+
- label: GiftCardProduct data types
145+
url: /graphql/product/gift-card-product.html
141146

142-
- label: GiftCardProduct endpoint
143-
url: /graphql/reference/gift-card-product.html
147+
- label: GroupedProduct data types
148+
url: /graphql/product/grouped-product.html
144149

145-
- label: GroupedProduct endpoint
146-
url: /graphql/reference/grouped-product.html
150+
- label: Reference
151+
children:
152+
- label: Customer endpoint
153+
url: /graphql/reference/customer.html
147154

148155
- label: Quote endpoint (cart query)
149156
url: /graphql/reference/quote.html

_data/whats-new.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ entries:
474474
date: June 22, 2019
475475
link: https://github.com/magento/devdocs/pull/4402
476476
- description: Added the `only_x_left_in_stock` and `stock_status` attributes to the
477-
[Products endpoint](https://devdocs.magento.com/guides/v2.3/graphql/reference/products.html).
477+
[Products endpoint](https://devdocs.magento.com/guides/v2.3/graphql/queries/products.html).
478478
These attributes were added to support Inventory Management orders.
479479
versions: 2.3.2
480480
type: Technical changes
@@ -1032,8 +1032,8 @@ entries:
10321032
type: Technical changes
10331033
date: March 26, 2019
10341034
link: https://github.com/magento/devdocs/pull/3882
1035-
- description: Added query and mutation to the [configurable]( https://devdocs.magento.com/guides/v2.3/graphql/reference/configurable-product.html)
1036-
and [downloadable product](https://devdocs.magento.com/guides/v2.3/graphql/reference/downloadable-product.html)
1035+
- description: Added query and mutation to the [configurable]( https://devdocs.magento.com/guides/v2.3/graphql/product/configurable-product.html)
1036+
and [downloadable product](https://devdocs.magento.com/guides/v2.3/graphql/product/downloadable-product.html)
10371037
endpoints
10381038
versions: 2.3.1
10391039
type: Major update
@@ -1045,7 +1045,7 @@ entries:
10451045
type: Major update
10461046
date: March 26, 2019
10471047
link: https://github.com/magento/devdocs/pull/3840
1048-
- description: Added `url_path`, `url_key`, and `url_rewrites` to [product endpoint](https://devdocs.magento.com/guides/v2.3/graphql/reference/products.html)
1048+
- description: Added `url_path`, `url_key`, and `url_rewrites` to [product endpoint](https://devdocs.magento.com/guides/v2.3/graphql/queries/products.html)
10491049
and added URL rewrite attributes and examples to [UrlRewrite endpoint](https://devdocs.magento.com/guides/v2.3/graphql/reference/url-resolver.html)
10501050
versions: 2.3.1
10511051
type: Major update
@@ -1061,7 +1061,7 @@ entries:
10611061
type: New topic
10621062
date: March 26, 2019
10631063
link: https://github.com/magento/devdocs/pull/3855
1064-
- description: Added an example to [CustomizableOptionInterface](https://devdocs.magento.com/guides/v2.3/graphql/reference/customizable-option-interface.html)
1064+
- description: Added an example to [CustomizableOptionInterface](https://devdocs.magento.com/guides/v2.3/graphql/product/customizable-option-interface.html)
10651065
versions: 2.3.1
10661066
type: Major update
10671067
date: March 26, 2019
@@ -1619,7 +1619,7 @@ entries:
16191619
versions: 2.3.x
16201620
type: Major update
16211621
date: November 20 2018
1622-
- description: Added `CatalogInventory` attributes to the [products query](https://devdocs.magento.com/guides/v2.3/graphql/reference/products.html).
1622+
- description: Added `CatalogInventory` attributes to the [products query](https://devdocs.magento.com/guides/v2.3/graphql/queries/products.html).
16231623
versions: 2.3.x
16241624
type: Technical changes
16251625
date: November 16 2018
@@ -1885,7 +1885,7 @@ entries:
18851885
versions: 2.3.x
18861886
type: Technical changes
18871887
date: Sep 5 2018
1888-
- description: Added a note about filtered product attributes in [Products endpoint](https://devdocs.magento.com/guides/v2.3/graphql/reference/products.html)
1888+
- description: Added a note about filtered product attributes in [Products endpoint](https://devdocs.magento.com/guides/v2.3/graphql/queries/products.html)
18891889
versions: 2.3.x
18901890
type: Technical changes
18911891
date: Sep 5 2018
@@ -1957,7 +1957,7 @@ entries:
19571957
versions: 2.3.x
19581958
type: Major update
19591959
date: Aug 21 2018
1960-
- description: Added information about breadcrumbs in the [GraphQL category](https://devdocs.magento.com/guides/v2.3/graphql/reference/categories.html)
1960+
- description: Added information about breadcrumbs in the [GraphQL category](https://devdocs.magento.com/guides/v2.3/graphql/queries/category.html)
19611961
topic.
19621962
versions: 2.3.x
19631963
type: Major update
@@ -2218,7 +2218,7 @@ entries:
22182218
versions: 2.1.x, 2.2.x, 2.3.x
22192219
type: Technical changes
22202220
date: May 29 2018
2221-
- description: Updated the GraphQL [Products endpoint](https://devdocs.magento.com/guides/v2.3/graphql/reference/products.html)
2221+
- description: Updated the GraphQL [Products endpoint](https://devdocs.magento.com/guides/v2.3/graphql/queries/products.html)
22222222
to include functionality contributed by community members.
22232223
versions: 2.3.x
22242224
type: Technical changes
@@ -2251,7 +2251,7 @@ entries:
22512251
versions: 2.1.x, 2.2.x, 2.3.x
22522252
type: Technical changes
22532253
date: May 15 2018
2254-
- description: Added filter attribute information in [GraphQL Product](https://devdocs.magento.com/guides/v2.3/graphql/reference/products.html)
2254+
- description: Added filter attribute information in [GraphQL Product](https://devdocs.magento.com/guides/v2.3/graphql/queries/products.html)
22552255
versions: 2.3.x
22562256
type: Technical changes
22572257
date: May 10 2018
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
group: graphql
3+
title: addConfigurableProductsToCart mutation
4+
---
5+
6+
Use the `addConfigurableProductsToCart` mutation to add configurable products to a specific cart.
7+
8+
## Syntax
9+
10+
`mutation: {addConfigurableProductsToCart(input: AddConfigurableProductsToCartInput) {AddConfigurableProductsToCartOutput}}`
11+
12+
## Example usage
13+
14+
The following example adds two black Teton Pullover Hoodies size extra-small to the specified shopping cart. The `cart_id` used in this example was [generated]({{ page.baseurl }}/graphql/reference/quote-create-cart.html) by creating an empty cart.
15+
16+
**Request**
17+
18+
```graphql
19+
mutation {
20+
addConfigurableProductsToCart(
21+
input: {
22+
cart_id: "4JQaNVJokOpFxrykGVvYrjhiNv9qt31C"
23+
cart_items: [
24+
{
25+
variant_sku: "MH02"
26+
data: {
27+
quantity: 2
28+
sku: "MH02-XS-Black"
29+
}
30+
}
31+
]
32+
}
33+
) {
34+
cart {
35+
items {
36+
id
37+
quantity
38+
product {
39+
name
40+
sku
41+
}
42+
... on ConfigurableCartItem {
43+
configurable_options {
44+
option_label
45+
}
46+
}
47+
}
48+
}
49+
}
50+
}
51+
```
52+
53+
**Response**
54+
55+
```json
56+
{
57+
"data": {
58+
"addConfigurableProductsToCart": {
59+
"cart": {
60+
"items": [
61+
{
62+
"id": "26",
63+
"quantity": 2,
64+
"product": {
65+
"name": "Teton Pullover Hoodie-XS-Black",
66+
"sku": "MH02-XS-Black"
67+
}
68+
}
69+
]
70+
}
71+
}
72+
}
73+
}
74+
```
75+
76+
## Input attributes
77+
78+
### AddConfigurableProductsToCartInput object
79+
80+
The `AddConfigurableProductsToCartInput` object contains the following attributes:
81+
82+
Attribute | Type | Description
83+
--- | --- | ---
84+
`cart_items` | [[ConfigurableProductCartItemInput]](#configProdCartItemInput) | An array of configurable items to add to the cart
85+
`cart_id` | String | The unique ID that identifies the customer's cart
86+
87+
### ConfigurableProductCartItemInput object {#configProdCartItemInput}
88+
89+
The `ConfigurableProductCartItemInput` object contains the following attributes:
90+
91+
Attribute | Type | Description
92+
--- | --- | ---
93+
`customizable_options` | [CustomizableOptionInput](#customOptionInput) | An object that contains the ID and value of the product
94+
`data` | [CartItemInput](#cartItemInput) | An object that contains the quantity and SKU of the configurable product
95+
`variant_sku` | String | The SKU of the simple product
96+
97+
### CustomizableOptionInput object {#customOptionInput}
98+
99+
The `CustomizableOptionInput` object contains the following attributes:
100+
101+
Attribute | Type | Description
102+
--- | --- | ---
103+
`id` | Int | The ID of the customizable option
104+
`value` | String | The value of the customizable option. For example, if color was the customizable option, a possible value could be `black`
105+
106+
### CartItemInput object {#cartItemInput}
107+
108+
The `CartItemInput` object contains the following attributes:
109+
110+
Attribute | Type | Description
111+
--- | --- | ---
112+
`quantity` | Float | The number of configurable items to add to the cart
113+
`sku` | String | The SKU of the configurable product
114+
115+
## Output attributes
116+
117+
The `AddConfigurableProductsToCartOutput` object contains the `Cart` object.
118+
119+
Attribute | Data Type | Description
120+
--- | --- | ---
121+
`cart` |[Cart!](#CartObject) | Describes the contents of the specified shopping cart
122+
123+
### Cart object {#CartObject}
124+
125+
{% include graphql/cart-object.md %}
126+
127+
[Cart query output]({{page.baseurl}}/graphql/reference/quote.html#cart-output) provides more information about the `Cart` object.
128+
129+
## Related topics
130+
131+
- [Configurable product data types]({{page.baseurl}}/graphql/product/configurable-product.html)

0 commit comments

Comments
 (0)