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

Commit 9e1933e

Browse files
authored
Merge pull request #7806 from andrewbess/new-topic/graphql-interfaces-virtual-product
Added "Virtual product data types" topic to graphql
2 parents 9fdf6db + 12f0ee7 commit 9e1933e

File tree

7 files changed

+218
-3
lines changed

7 files changed

+218
-3
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: Virtual product data types
279+
url: /graphql/interfaces/virtual-product.html
280+
278281
- label: Payment methods
279282
children:
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
@@ -15,7 +15,7 @@ Product type | Implements | Has product-specific attributes?
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
1717
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
18-
VirtualProduct | [ProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html), [CustomizableProductInterface]({{ page.baseurl }}/graphql/interfaces/customizable-option-interface.html) | No
18+
[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
2121

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The `items` that are returned in a `ProductInterface` array can also contain att
1515
- [ConfigurableProduct]({{ page.baseurl }}/graphql/interfaces/configurable-product.html)
1616
- [DownloadableProduct]({{ page.baseurl }}/graphql/interfaces/downloadable-product.html)
1717
- [GroupedProduct]({{ page.baseurl }}/graphql/interfaces/grouped-product.html)
18+
- [VirtualProduct]({{ page.baseurl }}/graphql/interfaces/virtual-product.html)
1819

1920
## ProductInterface attributes
2021

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
group: graphql
3+
title: Virtual product data types
4+
contributor_name: Atwix
5+
contributor_link: https://www.atwix.com/
6+
---
7+
8+
The `VirtualProduct` data type implements the following interfaces:
9+
10+
- `ProductInterface`
11+
- `CustomizableProductInterface`
12+
13+
All `VirtualProduct` attributes are defined in the implemented interfaces.
14+
15+
## Sample Query
16+
17+
The following [`products`]({{page.baseurl}}/graphql/queries/products.html) query returns information about a virtual product.
18+
19+
```graphql
20+
{
21+
products(
22+
filter: {
23+
sku: {
24+
eq: "test-virtual-product"
25+
}
26+
}
27+
) {
28+
items {
29+
sku
30+
__typename
31+
id
32+
name
33+
categories {
34+
id
35+
name
36+
path
37+
}
38+
price_range {
39+
minimum_price {
40+
final_price {
41+
currency
42+
value
43+
}
44+
}
45+
maximum_price {
46+
final_price {
47+
currency
48+
value
49+
}
50+
}
51+
}
52+
stock_status
53+
}
54+
}
55+
}
56+
```
57+
58+
{% collapsible Response %}
59+
60+
```json
61+
{
62+
"data": {
63+
"products": {
64+
"items": [
65+
{
66+
"sku": "test-virtual-product",
67+
"__typename": "VirtualProduct",
68+
"id": 2047,
69+
"name": "Test Virtual Product",
70+
"categories": [
71+
{
72+
"id": 37,
73+
"name": "Sale",
74+
"path": "1/2/37"
75+
}
76+
],
77+
"price_range": {
78+
"minimum_price": {
79+
"final_price": {
80+
"currency": "USD",
81+
"value": 123
82+
}
83+
},
84+
"maximum_price": {
85+
"final_price": {
86+
"currency": "USD",
87+
"value": 123
88+
}
89+
}
90+
},
91+
"stock_status": "IN_STOCK"
92+
}
93+
]
94+
}
95+
}
96+
}
97+
```
98+
99+
{% endcollapsible %}
100+
101+
## Related topics
102+
103+
- [addVirtualProductsToCart mutation]({{page.baseurl}}/graphql/mutations/add-virtual-products.html)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Product type | Implements | Has product-specific attributes?
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
1616
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-
VirtualProduct | [ProductInterface]({{ page.baseurl }}/graphql/interfaces/product-interface.html), [CustomizableProductInterface]({{ page.baseurl }}/graphql/interfaces/customizable-option-interface.html) | No
17+
[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
2020

@@ -32,4 +32,4 @@ To return attributes that are specific to a product type, append a structure sim
3232

3333
For example, to return `GroupedProduct` attributes, construct your query like this:
3434

35-
{% include graphql/grouped-product-sample.md %}
35+
{% include graphql/grouped-product-sample.md %}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The `items` that are returned in a `ProductInterface` array can also contain att
1515
- [ConfigurableProduct]({{ page.baseurl }}/graphql/interfaces/configurable-product.html)
1616
- [DownloadableProduct]({{ page.baseurl }}/graphql/interfaces/downloadable-product.html)
1717
- [GroupedProduct]({{ page.baseurl }}/graphql/interfaces/grouped-product.html)
18+
- [VirtualProduct]({{ page.baseurl }}/graphql/interfaces/virtual-product.html)
1819

1920
## ProductInterface attributes
2021

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
group: graphql
3+
title: Virtual product data types
4+
contributor_name: Atwix
5+
contributor_link: https://www.atwix.com/
6+
---
7+
8+
The `VirtualProduct` data type implements the following interfaces:
9+
10+
- `ProductInterface`
11+
- `CustomizableProductInterface`
12+
13+
Attributes that are specific to the virtual products can be used when performing a [`products`]({{page.baseurl}}/graphql/queries/products.html) query.
14+
15+
## VirtualProduct object
16+
17+
The `VirtualProduct` object contains attributes only from implemented interfaces:
18+
19+
## Sample Query
20+
21+
The following query returns information about virtual product.
22+
23+
```graphql
24+
{
25+
products(
26+
filter: {
27+
sku: {
28+
eq: "test-virtual-product"
29+
}
30+
}
31+
) {
32+
items {
33+
sku
34+
__typename
35+
id
36+
name
37+
categories {
38+
id
39+
name
40+
path
41+
}
42+
price_range {
43+
minimum_price {
44+
final_price {
45+
currency
46+
value
47+
}
48+
}
49+
maximum_price {
50+
final_price {
51+
currency
52+
value
53+
}
54+
}
55+
}
56+
stock_status
57+
}
58+
}
59+
}
60+
```
61+
62+
{% collapsible Response %}
63+
64+
```json
65+
{
66+
"data": {
67+
"products": {
68+
"items": [
69+
{
70+
"sku": "test-virtual-product",
71+
"__typename": "VirtualProduct",
72+
"id": 2047,
73+
"name": "Test Virtual Product",
74+
"categories": [
75+
{
76+
"id": 37,
77+
"name": "Sale",
78+
"path": "1/2/37"
79+
}
80+
],
81+
"price_range": {
82+
"minimum_price": {
83+
"final_price": {
84+
"currency": "USD",
85+
"value": 123
86+
}
87+
},
88+
"maximum_price": {
89+
"final_price": {
90+
"currency": "USD",
91+
"value": 123
92+
}
93+
}
94+
},
95+
"stock_status": "IN_STOCK"
96+
}
97+
]
98+
}
99+
}
100+
}
101+
```
102+
103+
{% endcollapsible %}
104+
105+
## Related topics
106+
107+
- [addVirtualProductsToCart mutation]({{page.baseurl}}/graphql/mutations/add-virtual-products.html)

0 commit comments

Comments
 (0)