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

Commit 8f1d81a

Browse files
authored
Merge pull request #7805 from andrewbess/new-topic/graphql-interfaces-simple-product
Added "Simple product data types" topic to graphql
2 parents 9e1933e + f297076 commit 8f1d81a

File tree

7 files changed

+229
-2
lines changed

7 files changed

+229
-2
lines changed

src/_data/toc/graphql.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@ pages:
275275
- label: GroupedProduct data types
276276
url: /graphql/interfaces/grouped-product.html
277277

278+
- label: Simple product data types
279+
url: /graphql/interfaces/simple-product.html
280+
278281
- label: Virtual product data types
279282
url: /graphql/interfaces/virtual-product.html
280283

src/guides/v2.3/graphql/interfaces/product-interface-implementations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Product type | Implements | Has product-specific attributes?
1414
[ConfigurableProduct]({{ page.baseurl }}/graphql/interfaces/configurable-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html), [PhysicalProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/interfaces/customizable-option-interface.html) | Yes
1515
[DownloadableProduct]({{ page.baseurl }}/graphql/interfaces/downloadable-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html), [CustomizableProductInterface]({{ page.baseurl }}/graphql/interfaces/customizable-option-interface.html) | Yes
1616
[GroupedProduct]({{ page.baseurl }}/graphql/interfaces/grouped-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html), [PhysicalProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/interfaces/customizable-option-interface.html) | Yes
17-
SimpleProduct | [ProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html), [PhysicalProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/interfaces/customizable-option-interface.html) | No
17+
[SimpleProduct]({{ page.baseurl }}/graphql/interfaces/simple-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html), [PhysicalProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/interfaces/customizable-option-interface.html) | No
1818
[VirtualProduct]({{ page.baseurl }}/graphql/interfaces/virtual-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html), [CustomizableProductInterface]({{ page.baseurl }}/graphql/interfaces/customizable-option-interface.html) | No
1919

2020
## Query for product-specific attributes

src/guides/v2.3/graphql/interfaces/product-interface.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The `items` that are returned in a `ProductInterface` array can also contain att
1111
- Custom and extension attributes defined in any attribute set
1212
- The attribute is defined in the [PhysicalProductInterface](#PhysicalProductInterface) or [CustomizableOptionInterface]({{ page.baseurl }}/graphql/interfaces/customizable-option-interface.html)
1313
- Product types that define their own implementation of `ProductInterface` including:
14+
- [SimpleProduct]({{ page.baseurl }}/graphql/interfaces/simple-product.html)
1415
- [BundleProduct]({{ page.baseurl }}/graphql/interfaces/bundle-product.html)
1516
- [ConfigurableProduct]({{ page.baseurl }}/graphql/interfaces/configurable-product.html)
1617
- [DownloadableProduct]({{ page.baseurl }}/graphql/interfaces/downloadable-product.html)
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
group: graphql
3+
title: Simple product data types
4+
contributor_name: Atwix
5+
contributor_link: https://www.atwix.com/
6+
---
7+
8+
The `SimpleProduct` data type implements the following interfaces:
9+
10+
- `ProductInterface`
11+
- `PhysicalProductInterface`
12+
- `CustomizableProductInterface`
13+
14+
All `SimpleProduct` attributes are defined in the implemented interfaces.
15+
16+
## Sample Query
17+
18+
The following [`products`]({{page.baseurl}}/graphql/queries/products.html) query returns information about simple product `24-MB01`, which is defined in the sample data.
19+
20+
```graphql
21+
{
22+
products(
23+
filter: {
24+
sku: {
25+
eq: "24-MB01"
26+
}
27+
}
28+
) {
29+
items {
30+
sku
31+
__typename
32+
id
33+
name
34+
categories {
35+
id
36+
name
37+
path
38+
}
39+
price_range {
40+
minimum_price {
41+
final_price {
42+
currency
43+
value
44+
}
45+
}
46+
maximum_price {
47+
final_price {
48+
currency
49+
value
50+
}
51+
}
52+
}
53+
stock_status
54+
}
55+
}
56+
}
57+
```
58+
59+
{% collapsible Response %}
60+
61+
```json
62+
{
63+
"data": {
64+
"products": {
65+
"items": [
66+
{
67+
"sku": "24-MB01",
68+
"__typename": "SimpleProduct",
69+
"id": 1,
70+
"name": "Joust Duffle Bag",
71+
"categories": [
72+
{
73+
"id": 3,
74+
"name": "Gear",
75+
"path": "1/2/3"
76+
},
77+
{
78+
"id": 4,
79+
"name": "Bags",
80+
"path": "1/2/3/4"
81+
}
82+
],
83+
"price_range": {
84+
"minimum_price": {
85+
"final_price": {
86+
"currency": "USD",
87+
"value": 34
88+
}
89+
},
90+
"maximum_price": {
91+
"final_price": {
92+
"currency": "USD",
93+
"value": 34
94+
}
95+
}
96+
},
97+
"stock_status": "IN_STOCK"
98+
}
99+
]
100+
}
101+
}
102+
}
103+
```
104+
105+
{% endcollapsible %}
106+
107+
## Related topics
108+
109+
- [addSimpleProductsToCart mutation]({{page.baseurl}}/graphql/mutations/add-simple-products.html)

src/guides/v2.4/graphql/interfaces/product-interface-implementations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Product type | Implements | Has product-specific attributes?
1313
[ConfigurableProduct]({{ page.baseurl }}/graphql/interfaces/configurable-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html), [PhysicalProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/interfaces/customizable-option-interface.html) | Yes
1414
[DownloadableProduct]({{ page.baseurl }}/graphql/interfaces/downloadable-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html), [CustomizableProductInterface]({{ page.baseurl }}/graphql/interfaces/customizable-option-interface.html) | Yes
1515
[GroupedProduct]({{ page.baseurl }}/graphql/interfaces/grouped-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html), [PhysicalProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/interfaces/customizable-option-interface.html) | Yes
16-
SimpleProduct | [ProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html), [PhysicalProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/interfaces/customizable-option-interface.html) | No
16+
[SimpleProduct]({{ page.baseurl }}/graphql/interfaces/simple-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html), [PhysicalProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html#PhysicalProductInterface), [CustomizableProductInterface]({{ page.baseurl }}/graphql/interfaces/customizable-option-interface.html) | No
1717
[VirtualProduct]({{ page.baseurl }}/graphql/interfaces/virtual-product.html) | [ProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html), [CustomizableProductInterface]({{ page.baseurl }}/graphql/interfaces/customizable-option-interface.html) | No
1818

1919
## Query for product-specific attributes

src/guides/v2.4/graphql/interfaces/product-interface.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The `items` that are returned in a `ProductInterface` array can also contain att
1111
- Custom and extension attributes defined in any attribute set
1212
- The attribute is defined in the [PhysicalProductInterface](#PhysicalProductInterface) or [CustomizableOptionInterface]({{ page.baseurl }}/graphql/interfaces/customizable-option-interface.html)
1313
- Product types that define their own implementation of `ProductInterface` including:
14+
- [SimpleProduct]({{ page.baseurl }}/graphql/interfaces/simple-product.html)
1415
- [BundleProduct]({{ page.baseurl }}/graphql/interfaces/bundle-product.html)
1516
- [ConfigurableProduct]({{ page.baseurl }}/graphql/interfaces/configurable-product.html)
1617
- [DownloadableProduct]({{ page.baseurl }}/graphql/interfaces/downloadable-product.html)
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
---
2+
group: graphql
3+
title: Simple product data types
4+
contributor_name: Atwix
5+
contributor_link: https://www.atwix.com/
6+
---
7+
8+
The `SimpleProduct` data type implements the following interfaces:
9+
10+
- `ProductInterface`
11+
- `PhysicalProductInterface`
12+
- `CustomizableProductInterface`
13+
14+
Attributes that are specific to the simple products can be used when performing a [`products`]({{page.baseurl}}/graphql/queries/products.html) query.
15+
16+
## SimpleProduct object
17+
18+
The `SimpleProduct` object contains attributes only from implemented interfaces:
19+
20+
## Sample Query
21+
22+
The following query returns information about simple product `24-MB01`, which is defined in the sample data.
23+
24+
```graphql
25+
{
26+
products(
27+
filter: {
28+
sku: {
29+
eq: "24-MB01"
30+
}
31+
}
32+
) {
33+
items {
34+
sku
35+
__typename
36+
id
37+
name
38+
categories {
39+
id
40+
name
41+
path
42+
}
43+
price_range {
44+
minimum_price {
45+
final_price {
46+
currency
47+
value
48+
}
49+
}
50+
maximum_price {
51+
final_price {
52+
currency
53+
value
54+
}
55+
}
56+
}
57+
stock_status
58+
}
59+
}
60+
}
61+
```
62+
63+
{% collapsible Response %}
64+
65+
```json
66+
{
67+
"data": {
68+
"products": {
69+
"items": [
70+
{
71+
"sku": "24-MB01",
72+
"__typename": "SimpleProduct",
73+
"id": 1,
74+
"name": "Joust Duffle Bag",
75+
"categories": [
76+
{
77+
"id": 3,
78+
"name": "Gear",
79+
"path": "1/2/3"
80+
},
81+
{
82+
"id": 4,
83+
"name": "Bags",
84+
"path": "1/2/3/4"
85+
}
86+
],
87+
"price_range": {
88+
"minimum_price": {
89+
"final_price": {
90+
"currency": "USD",
91+
"value": 34
92+
}
93+
},
94+
"maximum_price": {
95+
"final_price": {
96+
"currency": "USD",
97+
"value": 34
98+
}
99+
}
100+
},
101+
"stock_status": "IN_STOCK"
102+
}
103+
]
104+
}
105+
}
106+
}
107+
```
108+
109+
{% endcollapsible %}
110+
111+
## Related topics
112+
113+
- [addSimpleProductsToCart mutation]({{page.baseurl}}/graphql/mutations/add-simple-products.html)

0 commit comments

Comments
 (0)