diff --git a/src/guides/v2.4/graphql/product/bundle-product.md b/src/guides/v2.4/graphql/product/bundle-product.md deleted file mode 120000 index c59a4bc0cc1..00000000000 --- a/src/guides/v2.4/graphql/product/bundle-product.md +++ /dev/null @@ -1 +0,0 @@ -../../../v2.3/graphql/product/bundle-product.md \ No newline at end of file diff --git a/src/guides/v2.4/graphql/product/bundle-product.md b/src/guides/v2.4/graphql/product/bundle-product.md new file mode 100644 index 00000000000..888958b538f --- /dev/null +++ b/src/guides/v2.4/graphql/product/bundle-product.md @@ -0,0 +1,317 @@ +--- +group: graphql +title: Bundle product data types +--- + +The `BundleProduct` data type implements the following interfaces: + +- `ProductInterface` +- `PhysicalProductInterface` +- `CustomizableProductInterface` + +Attributes that are specific to bundle products can be used when performing a [`products`]({{page.baseurl}}/graphql/queries/products.html) query. + +## BundleProduct object + +The `BundleProduct` object contains the following attributes: + +Attribute | Type | Description +--- | --- | --- +`dynamic_price` | Boolean | Indicates whether the bundle product has a dynamic price +`dynamic_sku` | Boolean | Indicates whether the bundle product has a dynamic SKU +`dynamic_weight` | Boolean | Indicates whether the bundle product has a dynamically calculated weight +`items` | [BundleItem] | An array containing information about individual bundle items +`price_view` | PriceViewEnum | One of PRICE_RANGE or AS_LOW_AS +`ship_bundle_items` | ShipBundleItemsEnum | Indicates whether to ship bundle items TOGETHER or SEPARATELY + +## BundleItem object + +The `BundleItem` object contains the following attributes: + +Attribute | Type | Description +--- | --- | --- +`option_id` | Int | An ID assigned to each type of item in a bundle product +`options` | [BundleItemOption] | An array of additional options for this bundle item +`position` | Int | The relative position of this item compared to the other bundle items +`required` | Boolean | Indicates whether the item must be included in the bundle +`sku` | String | The SKU of the bundle product +`title` | String | The display name of the item +`type` | String | The input type that the customer uses to select the item. Examples include radio button and checkbox. + +## BundleItemOption object + +The `BundleItemOption` object contains the following attributes: + +Attribute | Type | Description +--- | --- | --- +`can_change_quantity` | Boolean | Indicates whether the customer can change the number of items for this option +`id` | Int | The ID assigned to the bundled item option +`is_default` | Boolean | Indicates whether this option is the default option +`label` | String | The text that identifies the bundled item option +`position` | Int | When a bundle item contains multiple options, the relative position of this option compared to the other options +`price_type` | PriceTypeEnum | One of FIXED, PERCENT, or DYNAMIC +`price` | Float | The price of the selected option +`product` | [ProductInterface]({{page.baseurl}}/graphql/product/product-interface.html) | Contains details about this product option +`qty` | Float | Deprecated. Use `quantity` instead +`quantity` | Float | Indicates the quantity of this specific bundle item +`uid` | ID! | A string that encodes option details + +## Sample Query + +The following query returns information about bundle product `24-WG080`, which is defined in the sample data. + +```graphql +{ + products(filter: {sku: + {eq: "24-WG080"} + }) + { + items{ + sku + __typename + id + name + ... on BundleProduct { + dynamic_sku + dynamic_price + dynamic_weight + price_view + ship_bundle_items + items { + option_id + title + required + type + position + sku + options { + id + uid + quantity + position + is_default + price + price_type + can_change_quantity + label + product { + id + name + sku + __typename + } + } + } + } + } + } +} +``` + +{% collapsible Response %} + +```json +{ + "data": { + "products": { + "items": [ + { + "sku": "24-WG080", + "__typename": "BundleProduct", + "id": 46, + "name": "Sprite Yoga Companion Kit", + "dynamic_sku": true, + "dynamic_price": true, + "dynamic_weight": true, + "price_view": "PRICE_RANGE", + "ship_bundle_items": "TOGETHER", + "items": [ + { + "option_id": 1, + "title": "Sprite Stasis Ball", + "required": true, + "type": "radio", + "position": 1, + "sku": "24-WG080", + "options": [ + { + "id": 1, + "uid": "YnVuZGxlLzEvMS8x", + "quantity": 1, + "position": 1, + "is_default": true, + "price": 0, + "price_type": "FIXED", + "can_change_quantity": true, + "label": "Sprite Stasis Ball 55 cm", + "product": { + "id": 26, + "name": "Sprite Stasis Ball 55 cm", + "sku": "24-WG081-blue", + "__typename": "SimpleProduct" + } + }, + { + "id": 2, + "uid": "YnVuZGxlLzEvMi8x", + "quantity": 1, + "position": 2, + "is_default": false, + "price": 0, + "price_type": "FIXED", + "can_change_quantity": true, + "label": "Sprite Stasis Ball 65 cm", + "product": { + "id": 29, + "name": "Sprite Stasis Ball 65 cm", + "sku": "24-WG082-blue", + "__typename": "SimpleProduct" + } + }, + { + "id": 3, + "uid": "YnVuZGxlLzEvMy8x", + "quantity": 1, + "position": 3, + "is_default": false, + "price": 0, + "price_type": "FIXED", + "can_change_quantity": true, + "label": "Sprite Stasis Ball 75 cm", + "product": { + "id": 32, + "name": "Sprite Stasis Ball 75 cm", + "sku": "24-WG083-blue", + "__typename": "SimpleProduct" + } + } + ] + }, + { + "option_id": 2, + "title": "Sprite Foam Yoga Brick", + "required": true, + "type": "radio", + "position": 2, + "sku": "24-WG080", + "options": [ + { + "id": 4, + "uid": "YnVuZGxlLzIvNC8x", + "quantity": 1, + "position": 1, + "is_default": true, + "price": 0, + "price_type": "FIXED", + "can_change_quantity": true, + "label": "Sprite Foam Yoga Brick", + "product": { + "id": 21, + "name": "Sprite Foam Yoga Brick", + "sku": "24-WG084", + "__typename": "SimpleProduct" + } + } + ] + }, + { + "option_id": 3, + "title": "Sprite Yoga Strap", + "required": true, + "type": "radio", + "position": 3, + "sku": "24-WG080", + "options": [ + { + "id": 5, + "uid": "YnVuZGxlLzMvNS8x", + "quantity": 1, + "position": 1, + "is_default": true, + "price": 0, + "price_type": "FIXED", + "can_change_quantity": true, + "label": "Sprite Yoga Strap 6 foot", + "product": { + "id": 33, + "name": "Sprite Yoga Strap 6 foot", + "sku": "24-WG085", + "__typename": "SimpleProduct" + } + }, + { + "id": 6, + "uid": "YnVuZGxlLzMvNi8x", + "quantity": 1, + "position": 2, + "is_default": false, + "price": 0, + "price_type": "FIXED", + "can_change_quantity": true, + "label": "Sprite Yoga Strap 8 foot", + "product": { + "id": 34, + "name": "Sprite Yoga Strap 8 foot", + "sku": "24-WG086", + "__typename": "SimpleProduct" + } + }, + { + "id": 7, + "uid": "YnVuZGxlLzMvNy8x", + "quantity": 1, + "position": 3, + "is_default": false, + "price": 0, + "price_type": "FIXED", + "can_change_quantity": true, + "label": "Sprite Yoga Strap 10 foot", + "product": { + "id": 35, + "name": "Sprite Yoga Strap 10 foot", + "sku": "24-WG087", + "__typename": "SimpleProduct" + } + } + ] + }, + { + "option_id": 4, + "title": "Sprite Foam Roller", + "required": true, + "type": "radio", + "position": 4, + "sku": "24-WG080", + "options": [ + { + "id": 8, + "uid": "YnVuZGxlLzQvOC8x", + "quantity": 1, + "position": 1, + "is_default": true, + "price": 0, + "price_type": "FIXED", + "can_change_quantity": true, + "label": "Sprite Foam Roller", + "product": { + "id": 22, + "name": "Sprite Foam Roller", + "sku": "24-WG088", + "__typename": "SimpleProduct" + } + } + ] + } + ] + } + ] + } + } +} +``` + +{% endcollapsible %} + +## Related topics + +- [addBundleProductsToCart mutation]({{page.baseurl}}/graphql/mutations/add-bundle-products.html) diff --git a/src/guides/v2.4/graphql/product/configurable-product.md b/src/guides/v2.4/graphql/product/configurable-product.md index 76aba8bcc0a..ff2b1fb5351 100644 --- a/src/guides/v2.4/graphql/product/configurable-product.md +++ b/src/guides/v2.4/graphql/product/configurable-product.md @@ -37,6 +37,7 @@ Field | Type | Description --- | --- | --- `code` | String | The ID assigned to the attribute `label` | String | A string that describes the configurable attribute option +`uid` | ID! | A string that encodes option details `value_index` | Int | A unique index number assigned to the configurable product option ### ConfigurableProductOptions {#configProdOptions} @@ -154,6 +155,7 @@ The following `products` query returns `ConfigurableProduct` information about t } } attributes { + uid label code value_index @@ -179,7 +181,7 @@ The following `products` query returns `ConfigurableProduct` information about t "attribute_set_id": 9, "name": "Mona Pullover Hoodlie", "sku": "WH01", - "__typename": "configurable", + "__typename": "ConfigurableProduct", "price_range": { "minimum_price": { "regular_price": { @@ -190,10 +192,10 @@ The following `products` query returns `ConfigurableProduct` information about t }, "categories": [ { - "id": 2 + "id": 8 }, { - "id": 8 + "id": 21 }, { "id": 24 @@ -228,30 +230,30 @@ The following `products` query returns `ConfigurableProduct` information about t }, { "id": 146, - "attribute_id_v2": 160, + "attribute_id_v2": 144, "label": "Size", "position": 0, "use_default": false, "attribute_code": "size", "values": [ { - "value_index": 176, + "value_index": 166, "label": "XS" }, { - "value_index": 177, + "value_index": 167, "label": "S" }, { - "value_index": 178, + "value_index": 168, "label": "M" }, { - "value_index": 179, + "value_index": 169, "label": "L" }, { - "value_index": 180, + "value_index": 170, "label": "XL" } ], @@ -277,14 +279,16 @@ The following `products` query returns `ConfigurableProduct` information about t }, "attributes": [ { + "uid": "Y29uZmlndXJhYmxlLzkzLzUz", "label": "Green", "code": "color", "value_index": 53 }, { + "uid": "Y29uZmlndXJhYmxlLzE0NC8xNjY=", "label": "XS", "code": "size", - "value_index": 176 + "value_index": 166 } ] }, @@ -306,14 +310,16 @@ The following `products` query returns `ConfigurableProduct` information about t }, "attributes": [ { + "uid": "Y29uZmlndXJhYmxlLzkzLzU2", "label": "Orange", "code": "color", "value_index": 56 }, { + "uid": "Y29uZmlndXJhYmxlLzE0NC8xNjY=", "label": "XS", "code": "size", - "value_index": 176 + "value_index": 166 } ] }, @@ -335,14 +341,16 @@ The following `products` query returns `ConfigurableProduct` information about t }, "attributes": [ { + "uid": "Y29uZmlndXJhYmxlLzkzLzU3", "label": "Purple", "code": "color", "value_index": 57 }, { + "uid": "Y29uZmlndXJhYmxlLzE0NC8xNjY=", "label": "XS", "code": "size", - "value_index": 176 + "value_index": 166 } ] }, @@ -364,14 +372,16 @@ The following `products` query returns `ConfigurableProduct` information about t }, "attributes": [ { + "uid": "Y29uZmlndXJhYmxlLzkzLzUz", "label": "Green", "code": "color", "value_index": 53 }, { + "uid": "Y29uZmlndXJhYmxlLzE0NC8xNjc=", "label": "S", "code": "size", - "value_index": 177 + "value_index": 167 } ] }, @@ -393,14 +403,16 @@ The following `products` query returns `ConfigurableProduct` information about t }, "attributes": [ { + "uid": "Y29uZmlndXJhYmxlLzkzLzU2", "label": "Orange", "code": "color", "value_index": 56 }, { + "uid": "Y29uZmlndXJhYmxlLzE0NC8xNjc=", "label": "S", "code": "size", - "value_index": 177 + "value_index": 167 } ] }, @@ -422,14 +434,16 @@ The following `products` query returns `ConfigurableProduct` information about t }, "attributes": [ { + "uid": "Y29uZmlndXJhYmxlLzkzLzU3", "label": "Purple", "code": "color", "value_index": 57 }, { + "uid": "Y29uZmlndXJhYmxlLzE0NC8xNjc=", "label": "S", "code": "size", - "value_index": 177 + "value_index": 167 } ] }, @@ -451,14 +465,16 @@ The following `products` query returns `ConfigurableProduct` information about t }, "attributes": [ { + "uid": "Y29uZmlndXJhYmxlLzkzLzUz", "label": "Green", "code": "color", "value_index": 53 }, { + "uid": "Y29uZmlndXJhYmxlLzE0NC8xNjg=", "label": "M", "code": "size", - "value_index": 178 + "value_index": 168 } ] }, @@ -480,14 +496,16 @@ The following `products` query returns `ConfigurableProduct` information about t }, "attributes": [ { + "uid": "Y29uZmlndXJhYmxlLzkzLzU2", "label": "Orange", "code": "color", "value_index": 56 }, { + "uid": "Y29uZmlndXJhYmxlLzE0NC8xNjg=", "label": "M", "code": "size", - "value_index": 178 + "value_index": 168 } ] }, @@ -509,14 +527,16 @@ The following `products` query returns `ConfigurableProduct` information about t }, "attributes": [ { + "uid": "Y29uZmlndXJhYmxlLzkzLzU3", "label": "Purple", "code": "color", "value_index": 57 }, { + "uid": "Y29uZmlndXJhYmxlLzE0NC8xNjg=", "label": "M", "code": "size", - "value_index": 178 + "value_index": 168 } ] }, @@ -538,14 +558,16 @@ The following `products` query returns `ConfigurableProduct` information about t }, "attributes": [ { + "uid": "Y29uZmlndXJhYmxlLzkzLzUz", "label": "Green", "code": "color", "value_index": 53 }, { + "uid": "Y29uZmlndXJhYmxlLzE0NC8xNjk=", "label": "L", "code": "size", - "value_index": 179 + "value_index": 169 } ] }, @@ -567,14 +589,16 @@ The following `products` query returns `ConfigurableProduct` information about t }, "attributes": [ { + "uid": "Y29uZmlndXJhYmxlLzkzLzU2", "label": "Orange", "code": "color", "value_index": 56 }, { + "uid": "Y29uZmlndXJhYmxlLzE0NC8xNjk=", "label": "L", "code": "size", - "value_index": 179 + "value_index": 169 } ] }, @@ -596,14 +620,16 @@ The following `products` query returns `ConfigurableProduct` information about t }, "attributes": [ { + "uid": "Y29uZmlndXJhYmxlLzkzLzU3", "label": "Purple", "code": "color", "value_index": 57 }, { + "uid": "Y29uZmlndXJhYmxlLzE0NC8xNjk=", "label": "L", "code": "size", - "value_index": 179 + "value_index": 169 } ] }, @@ -625,14 +651,16 @@ The following `products` query returns `ConfigurableProduct` information about t }, "attributes": [ { + "uid": "Y29uZmlndXJhYmxlLzkzLzUz", "label": "Green", "code": "color", "value_index": 53 }, { + "uid": "Y29uZmlndXJhYmxlLzE0NC8xNzA=", "label": "XL", "code": "size", - "value_index": 180 + "value_index": 170 } ] }, @@ -654,14 +682,16 @@ The following `products` query returns `ConfigurableProduct` information about t }, "attributes": [ { + "uid": "Y29uZmlndXJhYmxlLzkzLzU2", "label": "Orange", "code": "color", "value_index": 56 }, { + "uid": "Y29uZmlndXJhYmxlLzE0NC8xNzA=", "label": "XL", "code": "size", - "value_index": 180 + "value_index": 170 } ] }, @@ -683,14 +713,16 @@ The following `products` query returns `ConfigurableProduct` information about t }, "attributes": [ { + "uid": "Y29uZmlndXJhYmxlLzkzLzU3", "label": "Purple", "code": "color", "value_index": 57 }, { + "uid": "Y29uZmlndXJhYmxlLzE0NC8xNzA=", "label": "XL", "code": "size", - "value_index": 180 + "value_index": 170 } ] } diff --git a/src/guides/v2.4/graphql/product/customizable-option-interface.md b/src/guides/v2.4/graphql/product/customizable-option-interface.md deleted file mode 120000 index 6d99384efb1..00000000000 --- a/src/guides/v2.4/graphql/product/customizable-option-interface.md +++ /dev/null @@ -1 +0,0 @@ -../../../v2.3/graphql/product/customizable-option-interface.md \ No newline at end of file diff --git a/src/guides/v2.4/graphql/product/customizable-option-interface.md b/src/guides/v2.4/graphql/product/customizable-option-interface.md new file mode 100644 index 00000000000..c048be9884f --- /dev/null +++ b/src/guides/v2.4/graphql/product/customizable-option-interface.md @@ -0,0 +1,262 @@ +--- +group: graphql +title: CustomizableOptionInterface +--- + +Customizable options for a product provide a way to offer customers a selection of options with a variety of text, selection, and date input types. All product types can contain customizable options. + +`CustomizableOptionInterface` is defined in the `CatalogGraphQl` module, and its attributes can be used in any `products` query. This interface returns basic information about a customizable option and can be implemented by several types of configurable options: + +* Text area +* Checkbox +* Date picker +* Drop-down menu +* Text field +* File picker +* Multiple select box +* Radio buttons + + {:.bs-callout-info} +Magento has not implemented all possible customizable product options for GraphQL. + +`CustomizableOptionInterface` can contain the following attributes: + +Attribute | Type | Description +--- | --- | --- +`option_id` | Int | The ID assigned to the option +`required` | Boolean | Indicates whether the option is required +`sort_order` | Int | The order in which the option is displayed +`title` | String | The display name for this option + +## CustomizableAreaOption object + +`CustomizableAreaOption` contains information about a text area that is defined as part of a customizable option. + +Attribute | Type | Description +--- | --- | --- +`product_sku` | String | The Stock Keeping Unit of the base product +`value` | `CustomizableAreaValue` | An object that defines a text area + +### CustomizableAreaValue object + +`CustomizableAreaValue` defines the attributes of a product whose page contains a customized text area. + +Attribute | Type | Description +--- | --- | --- +`max_characters` | Int | The maximum number of characters that can be entered for this customizable option +`price_type` | PriceTypeEnum | FIXED, PERCENT, or DYNAMIC +`price` | Float | The price assigned to this option +`sku` | String | The Stock Keeping Unit for this option +`uid` | ID! | A string that encodes option details + +## CustomizableCheckboxOption object + +`CustomizableCheckboxOption` contains information about a set of checkbox values that are defined as part of a customizable option. + +Attribute | Type | Description +--- | --- | --- +`value` | `CustomizableCheckboxValue` | An array that defines a set of checkbox values + +### CustomizableCheckboxValue object + +`CustomizableCheckboxValue` defines the attributes of a product whose page contains a customized set of checkbox values. + +Attribute | Type | Description +--- | --- | --- +`option_type_id` | Int | The ID assigned to the value +`price_type` | PriceTypeEnum | FIXED, PERCENT, or DYNAMIC +`price` | Float | The price assigned to this option +`sku` | String | The Stock Keeping Unit for this option +`sort_order` | Int | The order in which the option is displayed +`title` | String | The display name for this option +`uid` | ID! | A string that encodes option details + +## CustomizableDateOption object + +`CustomizableDateOption` contains information about a date picker that is defined as part of a customizable option. + +Attribute | Type | Description +--- | --- | --- +`product_sku` | String | The Stock Keeping Unit of the base product +`value` | `CustomizableDateValue` | An object that defines a date field in a customizable option. + +### CustomizableDateValue object + +`CustomizableDateValue` defines the attributes of a product whose page contains a customized date picker. + +Attribute | Type | Description +--- | --- | --- +`price` | Float | The price assigned to this option +`price_type` | PriceTypeEnum | FIXED, PERCENT, or DYNAMIC +`sku` | String | The Stock Keeping Unit for this option +`uid` | ID! | A string that encodes option details + +## CustomizableDropDownOption object + +`CustomizableDropDownOption` contains information about a drop down menu that is defined as part of a customizable option. + +Attribute | Type | Description +--- | --- | --- +`value` | `CustomizableDropDownValue` | An array that defines the set of options for a drop down menu + +### CustomizableDropDownValue object + +`CustomizableDropDownValue` defines the attributes of a product whose page contains a customized drop down menu. + +Attribute | Type | Description +--- | --- | --- +`option_type_id` | Int | The ID assigned to the value +`price_type` | PriceTypeEnum | FIXED, PERCENT, or DYNAMIC +`price` | Float | The price assigned to this option +`sku` | String | The Stock Keeping Unit for this option +`sort_order` | Int | The order in which the option is displayed +`title` | String | The display name for this option +`uid` | ID! | A string that encodes option details + +## CustomizableFieldOption object + +`CustomizableFieldOption` contains information about a text field that is defined as part of a customizable option. + +Attribute | Type | Description +--- | --- | --- +`product_sku` | String | The Stock Keeping Unit of the base product +`value` | `CustomizableFieldValue` | An object that defines a text field + +### CustomizableFieldValue object + +`CustomizableFieldValue` defines the attributes of a product whose page contains a customized text field. + +Attribute | Type | Description +--- | --- | --- +`max_characters` | Int | The maximum number of characters that can be entered for this customizable option +`price_type` | PriceTypeEnum | FIXED, PERCENT, or DYNAMIC +`price` | Float | The price of the custom value +`sku` | String | The Stock Keeping Unit for this option +`uid` | ID! | A string that encodes option details + +## CustomizableFileOption object + +`CustomizableFileOption` contains information about a file picker that is defined as part of a customizable option. + +Attribute | Type | Description +--- | --- | --- +`product_sku` | String | The Stock Keeping Unit of the base product +`value` | `CustomizableFileValue` | An object that defines a file name + +### CustomizableFileValue object + +`CustomizableFileValue` defines the attributes of a product whose page contains a customized file picker. + +Attribute | Type | Description +--- | --- | --- +`file_extension` | String | The file extension to accept +`image_size_x` | Int | The maximum width of an image +`image_size_y` | Int | The maximum height of an image +`price_type` | PriceTypeEnum | FIXED, PERCENT, or DYNAMIC +`price` | Float | The price assigned to this option +`sku` | String | The Stock Keeping Unit for this option +`uid` | ID! | A string that encodes option details + +## CustomizableMultipleOption object + +`CustomizableMultipleOption` contains information about a multiselect that is defined as part of a customizable option. + +Attribute | Type | Description +--- | --- | --- +`value` | `CustomizableMultipleValue` | An array that defines the set of options for a multiselect + +### CustomizableMultipleValue object + +`CustomizableMultipleValue` defines the price and sku of a product whose page contains a customized multiselect + +Attribute | Type | Description +--- | --- | --- +`option_type_id` | Int | The ID assigned to the value +`price_type` | PriceTypeEnum | FIXED, PERCENT, or DYNAMIC +`price` | Float | The price assigned to this option +`sku` | String | The Stock Keeping Unit for this option +`sort_order` | Int | The order in which the option is displayed +`title` | String | The display name for this option +`uid` | ID! | A string that encodes option details + +## CustomizableRadioOption object + +`CustomizableRadioOption` contains information about a set of radio buttons that are defined as part of a customizable option. + +Attribute | Type | Description +--- | --- | --- +`value` | `CustomizableRadioValue` | An array that defines a set of radio buttons + +### CustomizableRadioValue object + +`CustomizableRadioValue` defines the attributes of a product whose page contains a customized set of radio buttons. + +Attribute | Type | Description +--- | --- | --- +`option_type_id` | Int | The ID assigned to the value +`price_type` | PriceTypeEnum | FIXED, PERCENT, or DYNAMIC +`price` | Float | The price assigned to this option +`sku` | String | The Stock Keeping Unit for this option +`sort_order` | Int | The order in which the option is displayed +`title` | String | The display name for this option## CustomizableRadioOption object +`uid` | ID! | A string that encodes option details + +`CustomizableRadioOption` contains information about a set of radio buttons that are defined as part of a customizable option. + +Attribute | Type | Description +--- | --- | --- +`value` | `CustomizableRadioValue` | An array that defines a set of radio buttons + +## Example usage + +The following query returns information about the customizable options configured for the product with a `sku` of `xyz`. + +**Request:** + +```graphql +{ + products(filter: {sku: {eq: "xyz"}}) { + items { + id + name + sku + __typename + ... on CustomizableProductInterface { + options { + title + required + sort_order + option_id + } + } + } + } +} +``` + +**Response:** + +```json +{ + "data": { + "products": { + "items": [ + { + "id": 1, + "name": "T-shirt", + "sku": "xyz", + "__typename": "SimpleProduct", + "options": [ + { + "title": "Image", + "required": false, + "sort_order": 1, + "option_id": 1 + } + ] + } + ] + } + } +} +``` diff --git a/src/guides/v2.4/graphql/product/downloadable-product.md b/src/guides/v2.4/graphql/product/downloadable-product.md deleted file mode 120000 index 5a311c275ab..00000000000 --- a/src/guides/v2.4/graphql/product/downloadable-product.md +++ /dev/null @@ -1 +0,0 @@ -../../../v2.3/graphql/product/downloadable-product.md \ No newline at end of file diff --git a/src/guides/v2.4/graphql/product/downloadable-product.md b/src/guides/v2.4/graphql/product/downloadable-product.md new file mode 100644 index 00000000000..4a9885e1696 --- /dev/null +++ b/src/guides/v2.4/graphql/product/downloadable-product.md @@ -0,0 +1,160 @@ +--- +group: graphql +title: Downloadable product data types +--- + +The `DownloadableProduct` data type implements `ProductInterface` and `CustomizableProductInterface`. As a result, attributes that are specific to downloadable products can be used when performing a [`products`]({{page.baseurl}}/graphql/queries/products.html) query. + +## Downloadable product + +The `DownloadableProduct` object contains the following attributes: + +Attribute | Type | Description +--- | --- | --- +`downloadable_product_links` | [`DownloadableProductLinks`] | An array containing information about the links for this downloadable product +`downloadable_product_samples` | [`DownloadableProductSamples`] | An array containing information about samples of this downloadable product +`links_purchased_separately` | Int | A value of 1 indicates that each link in the array must be purchased separately +`links_title` | String | The heading above the list of downloadable products + +### DownloadableProductSamples object + +The `DownloadableProductSamples` object contains the following attributes: + +Attribute | Type | Description +--- | --- | --- +`id` | Int | Deprecated. This attribute is not applicable for GraphQL +`sample_file` | String | Deprecated. Use `sample_url` instead +`sample_type` | DownloadableFileTypeEnum | Deprecated. Use `sample_url` instead +`sample_url` | String | The URL to the downloadable sample +`sort_order` | Int | A number indicating the sort order +`title` | String | The display name of the sample + +### DownloadableProductLinks object + +The `DownloadableProductLinks` object contains the following attributes: + +Attribute | Type | Description +--- | --- | --- +`id` | Int | Deprecated. This information should not be exposed on frontend +`is_shareable` | Boolean | Deprecated. This attribute is not applicable for GraphQL +`link_type` | DownloadableFileTypeEnum | Deprecated. Use `sample_url` instead +`number_of_downloads` | Int | Deprecated. This attribute is not applicable for GraphQL +`price` | Float | The price of the downloadable product +`sample_file` | String | Deprecated. Use `sample_url` instead +`sample_type` | DownloadableFileTypeEnum | Deprecated. Use `sample_url` instead +`sample_url` | String | The URL to the downloadable sample +`sort_order` | Int | A number indicating the sort order +`title` | String | The display name of the link +`uid` | ID! | A string that encodes option details + +## Example usage + +Add the following inline fragment to the output section of your `products` query to return information specific to downloadable products: + +```text +... on DownloadableProduct { + items { + + } +} +``` + +The following query returns information about downloadable product `240-LV04`, which is defined in the sample data. + +**Request:** + +```graphql +{ + products(filter: { sku: { eq: "240-LV04" } }) { + items { + id + name + sku + __typename + price_range{ + minimum_price{ + regular_price{ + value + currency + } + } + } + ... on DownloadableProduct { + links_title + links_purchased_separately + downloadable_product_links { + sample_url + sort_order + title + uid + price + } + downloadable_product_samples { + title + sort_order + sample_url + } + } + } + } +} +``` + +**Response:** + +```json +{ + "data": { + "products": { + "items": [ + { + "id": 47, + "name": "Beginner's Yoga", + "sku": "240-LV04", + "__typename": "DownloadableProduct", + "price_range": { + "minimum_price": { + "regular_price": { + "value": 6, + "currency": "USD" + } + } + }, + "links_title": "Downloads", + "links_purchased_separately": 0, + "downloadable_product_links": [ + { + "sample_url": "http://example.com/downloadable/download/linkSample/link_id/1/", + "sort_order": 1, + "title": "Beginner's Yoga", + "uid": "ZG93bmxvYWRhYmxlLzE=", + "price": 6 + } + ], + "downloadable_product_samples": [ + { + "title": "Trailer #1", + "sort_order": 1, + "sample_url": "http://example.com/downloadable/download/sample/sample_id/1/" + }, + { + "title": "Trailer #2", + "sort_order": 1, + "sample_url": "http://example.com/downloadable/download/sample/sample_id/2/" + }, + { + "title": "Trailer #3", + "sort_order": 1, + "sample_url": "http://example.com/downloadable/download/sample/sample_id/3/" + } + ] + } + ] + } + } +} +``` + +## Related topics + +- [customerDownloadableProducts query]({{page.baseurl}}/graphql/queries/customer-downloadable-products.html) diff --git a/src/guides/v2.4/graphql/product/gift-card-product.md b/src/guides/v2.4/graphql/product/gift-card-product.md deleted file mode 120000 index c0a5c8cab61..00000000000 --- a/src/guides/v2.4/graphql/product/gift-card-product.md +++ /dev/null @@ -1 +0,0 @@ -../../../v2.3/graphql/product/gift-card-product.md \ No newline at end of file diff --git a/src/guides/v2.4/graphql/product/gift-card-product.md b/src/guides/v2.4/graphql/product/gift-card-product.md new file mode 100644 index 00000000000..1348ba72ac4 --- /dev/null +++ b/src/guides/v2.4/graphql/product/gift-card-product.md @@ -0,0 +1,83 @@ +--- +group: graphql +title: Gift card product data types +ee_only: True +--- + +The `GiftCardProduct` data type defines properties of a gift card, including the minimum and maximum values and an array that contains the current and past values on the specific gift card + +It implements the following interfaces: + +- `ProductInterface` +- `PhysicalProductInterface` +- `CustomizableProductInterface` + +## GiftCardProduct object + +The `GiftCardProduct` object contains the following attributes: + +Attribute | Type | Description +--- | --- | --- +`allow_message` | Boolean | Indicates whether the customer can provide a message to accompany the gift card +`allow_open_amount` | Boolean | Indicates whether customers have the ability to set the value of the gift card +`giftcard_amounts` | [`GiftCardAmounts`] | An array that contains information about the values and ID of a gift card +`gift_card_options` | [CustomizableOptionInterface!]! | An array of gift card options +`giftcard_type` | `GiftCardTypeEnum` | Either VIRTUAL, PHYSICAL, or COMBINED +`is_redeemable` | Boolean | Indicates whether the customer can redeem the value on the card for cash +`lifetime` | Int | The number of days after purchase until the gift card expires. A null value means there is no limit +`message_max_length` | Int | The maximum number of characters a gift card message can contain +`open_amount_max` | Float | The maximum acceptable value of an open amount gift card +`open_amount_min` | Float | The minimum acceptable value of an open amount gift card + +## GiftCardAmounts object + +The `GiftCardAmounts` object contains the following attributes: + +Attribute | Type | Description +--- | --- | --- +`attribute_id` | Int | An internal attribute ID +`uid` | String | A string that encodes option details +`value_id` | Int | An ID that is assigned to each unique gift card amount +`value` | Float | The value of the gift card +`website_value` | Float |The value of the gift card +`website_id` | Int | ID of the website that generated the gift card + +## Sample Query + +The following query returns information about gift card product `GiftCard25`. (It is not defined in the sample data.) + +```graphql +{ + products(filter: { sku: { eq: "GiftCard25" } }) { + items { + id + __typename + name + sku + ... on GiftCardProduct { + allow_message + message_max_length + allow_open_amount + open_amount_min + open_amount_max + is_returnable + is_redeemable + giftcard_type + giftcard_amounts { + value_id + website_id + value + attribute_id + website_value + } + } + } + } +} +``` + +## Related topics + +- [applyGiftCardToCart mutation]({{page.baseurl}}/graphql/mutations/apply-giftcard.html) +- [redeemGiftCardBalanceAsStoreCredit mutation]({{page.baseurl}}/graphql/mutations/redeem-giftcard-balance.html) +- [removeGiftCardFromCart mutation]({{page.baseurl}}/graphql/mutations/remove-giftcard.html)