|
| 1 | +--- |
| 2 | +group: graphql |
| 3 | +title: CustomizableOptionInterface |
| 4 | +redirect_from: |
| 5 | + - /guides/v2.3/graphql/reference/customizable-option-interface.html |
| 6 | + - /guides/v2.3/graphql/product/customizable-option-interface.html |
| 7 | +--- |
| 8 | + |
| 9 | +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. |
| 10 | + |
| 11 | +`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: |
| 12 | + |
| 13 | +* Text area |
| 14 | +* Checkbox |
| 15 | +* Date picker |
| 16 | +* Drop-down menu |
| 17 | +* Text field |
| 18 | +* File picker |
| 19 | +* Multiple select box |
| 20 | +* Radio buttons |
| 21 | + |
| 22 | +{:.bs-callout-info} |
| 23 | +Magento has not implemented all possible customizable product options for GraphQL. |
| 24 | + |
| 25 | +`CustomizableOptionInterface` can contain the following attributes: |
| 26 | + |
| 27 | +Attribute | Type | Description |
| 28 | +--- | --- | --- |
| 29 | +`option_id` | Int | The ID assigned to the option |
| 30 | +`required` | Boolean | Indicates whether the option is required |
| 31 | +`sort_order` | Int | The order in which the option is displayed |
| 32 | +`title` | String | The display name for this option |
| 33 | + |
| 34 | +## CustomizableAreaOption object |
| 35 | + |
| 36 | +`CustomizableAreaOption` contains information about a text area that is defined as part of a customizable option. |
| 37 | + |
| 38 | +Attribute | Type | Description |
| 39 | +--- | --- | --- |
| 40 | +`product_sku` | String | The Stock Keeping Unit of the base product |
| 41 | +`value` | `CustomizableAreaValue` | An object that defines a text area |
| 42 | + |
| 43 | +### CustomizableAreaValue object |
| 44 | + |
| 45 | +`CustomizableAreaValue` defines the attributes of a product whose page contains a customized text area. |
| 46 | + |
| 47 | +Attribute | Type | Description |
| 48 | +--- | --- | --- |
| 49 | +`max_characters` | Int | The maximum number of characters that can be entered for this customizable option |
| 50 | +`price_type` | PriceTypeEnum | FIXED, PERCENT, or DYNAMIC |
| 51 | +`price` | Float | The price assigned to this option |
| 52 | +`sku` | String | The Stock Keeping Unit for this option |
| 53 | + |
| 54 | +## CustomizableCheckboxOption object |
| 55 | + |
| 56 | +`CustomizableCheckboxOption` contains information about a set of checkbox values that are defined as part of a customizable option. |
| 57 | + |
| 58 | +Attribute | Type | Description |
| 59 | +--- | --- | --- |
| 60 | +`value` | `CustomizableCheckboxValue` | An array that defines a set of checkbox values |
| 61 | + |
| 62 | +### CustomizableCheckboxValue object |
| 63 | + |
| 64 | +`CustomizableCheckboxValue` defines the attributes of a product whose page contains a customized set of checkbox values. |
| 65 | + |
| 66 | +Attribute | Type | Description |
| 67 | +--- | --- | --- |
| 68 | +`option_type_id` | Int | The ID assigned to the value |
| 69 | +`price_type` | PriceTypeEnum | FIXED, PERCENT, or DYNAMIC |
| 70 | +`price` | Float | The price assigned to this option |
| 71 | +`sku` | String | The Stock Keeping Unit for this option |
| 72 | +`sort_order` | Int | The order in which the option is displayed |
| 73 | +`title` | String | The display name for this option |
| 74 | + |
| 75 | +## CustomizableDateOption object |
| 76 | + |
| 77 | +`CustomizableDateOption` contains information about a date picker that is defined as part of a customizable option. |
| 78 | + |
| 79 | +Attribute | Type | Description |
| 80 | +--- | --- | --- |
| 81 | +`product_sku` | String | The Stock Keeping Unit of the base product |
| 82 | +`value` | `CustomizableDateValue` | An object that defines a date field in a customizable option. |
| 83 | + |
| 84 | +### CustomizableDateValue object |
| 85 | + |
| 86 | +`CustomizableDateValue` defines the attributes of a product whose page contains a customized date picker. |
| 87 | + |
| 88 | +Attribute | Type | Description |
| 89 | +--- | --- | --- |
| 90 | +`price` | Float | The price assigned to this option |
| 91 | +`price_type` | PriceTypeEnum | FIXED, PERCENT, or DYNAMIC |
| 92 | +`sku` | String | The Stock Keeping Unit for this option |
| 93 | + |
| 94 | +## CustomizableDropDownOption object |
| 95 | + |
| 96 | +`CustomizableDropDownOption` contains information about a drop down menu that is defined as part of a customizable option. |
| 97 | + |
| 98 | +Attribute | Type | Description |
| 99 | +--- | --- | --- |
| 100 | +`value` | `CustomizableDropDownValue` | An array that defines the set of options for a drop down menu |
| 101 | + |
| 102 | +### CustomizableDropDownValue object |
| 103 | + |
| 104 | +`CustomizableDropDownValue` defines the attributes of a product whose page contains a customized drop down menu. |
| 105 | + |
| 106 | +Attribute | Type | Description |
| 107 | +--- | --- | --- |
| 108 | +`option_type_id` | Int | The ID assigned to the value |
| 109 | +`price_type` | PriceTypeEnum | FIXED, PERCENT, or DYNAMIC |
| 110 | +`price` | Float | The price assigned to this option |
| 111 | +`sku` | String | The Stock Keeping Unit for this option |
| 112 | +`sort_order` | Int | The order in which the option is displayed |
| 113 | +`title` | String | The display name for this option |
| 114 | + |
| 115 | +## CustomizableFieldOption object |
| 116 | + |
| 117 | +`CustomizableFieldOption` contains information about a text field that is defined as part of a customizable option. |
| 118 | + |
| 119 | +Attribute | Type | Description |
| 120 | +--- | --- | --- |
| 121 | +`product_sku` | String | The Stock Keeping Unit of the base product |
| 122 | +`value` | `CustomizableFieldValue` | An object that defines a text field |
| 123 | + |
| 124 | +### CustomizableFieldValue object |
| 125 | + |
| 126 | +`CustomizableFieldValue` defines the attributes of a product whose page contains a customized text field. |
| 127 | + |
| 128 | +Attribute | Type | Description |
| 129 | +--- | --- | --- |
| 130 | +`max_characters` | Int | The maximum number of characters that can be entered for this customizable option |
| 131 | +`price_type` | PriceTypeEnum | FIXED, PERCENT, or DYNAMIC |
| 132 | +`price` | Float | The price of the custom value |
| 133 | +`sku` | String | The Stock Keeping Unit for this option |
| 134 | + |
| 135 | +## CustomizableFileOption object |
| 136 | + |
| 137 | +`CustomizableFileOption` contains information about a file picker that is defined as part of a customizable option. |
| 138 | + |
| 139 | +Attribute | Type | Description |
| 140 | +--- | --- | --- |
| 141 | +`product_sku` | String | The Stock Keeping Unit of the base product |
| 142 | +`value` | `CustomizableFileValue` | An object that defines a file name |
| 143 | + |
| 144 | +### CustomizableFileValue object |
| 145 | + |
| 146 | +`CustomizableFileValue` defines the attributes of a product whose page contains a customized file picker. |
| 147 | + |
| 148 | +Attribute | Type | Description |
| 149 | +--- | --- | --- |
| 150 | +`file_extension` | String | The file extension to accept |
| 151 | +`image_size_x` | Int | The maximum width of an image |
| 152 | +`image_size_y` | Int | The maximum height of an image |
| 153 | +`price_type` | PriceTypeEnum | FIXED, PERCENT, or DYNAMIC |
| 154 | +`price` | Float | The price assigned to this option |
| 155 | +`sku` | String | The Stock Keeping Unit for this option |
| 156 | + |
| 157 | +## CustomizableMultipleOption object |
| 158 | + |
| 159 | +`CustomizableMultipleOption` contains information about a multiselect that is defined as part of a customizable option. |
| 160 | + |
| 161 | +Attribute | Type | Description |
| 162 | +--- | --- | --- |
| 163 | +`value` | `CustomizableMultipleValue` | An array that defines the set of options for a multiselect |
| 164 | + |
| 165 | +### CustomizableMultipleValue object |
| 166 | + |
| 167 | +`CustomizableMultipleValue` defines the price and sku of a product whose page contains a customized multiselect |
| 168 | + |
| 169 | +Attribute | Type | Description |
| 170 | +--- | --- | --- |
| 171 | +`option_type_id` | Int | The ID assigned to the value |
| 172 | +`price_type` | PriceTypeEnum | FIXED, PERCENT, or DYNAMIC |
| 173 | +`price` | Float | The price assigned to this option |
| 174 | +`sku` | String | The Stock Keeping Unit for this option |
| 175 | +`sort_order` | Int | The order in which the option is displayed |
| 176 | +`title` | String | The display name for this option |
| 177 | + |
| 178 | +## CustomizableRadioOption object |
| 179 | + |
| 180 | +`CustomizableRadioOption` contains information about a set of radio buttons that are defined as part of a customizable option. |
| 181 | + |
| 182 | +Attribute | Type | Description |
| 183 | +--- | --- | --- |
| 184 | +`value` | `CustomizableRadioValue` | An array that defines a set of radio buttons |
| 185 | + |
| 186 | +### CustomizableRadioValue object |
| 187 | + |
| 188 | +`CustomizableRadioValue` defines the attributes of a product whose page contains a customized set of radio buttons. |
| 189 | + |
| 190 | +Attribute | Type | Description |
| 191 | +--- | --- | --- |
| 192 | +`option_type_id` | Int | The ID assigned to the value |
| 193 | +`price_type` | PriceTypeEnum | FIXED, PERCENT, or DYNAMIC |
| 194 | +`price` | Float | The price assigned to this option |
| 195 | +`sku` | String | The Stock Keeping Unit for this option |
| 196 | +`sort_order` | Int | The order in which the option is displayed |
| 197 | +`title` | String | The display name for this option## CustomizableRadioOption object |
| 198 | + |
| 199 | +`CustomizableRadioOption` contains information about a set of radio buttons that are defined as part of a customizable option. |
| 200 | + |
| 201 | +Attribute | Type | Description |
| 202 | +--- | --- | --- |
| 203 | +`value` | `CustomizableRadioValue` | An array that defines a set of radio buttons |
| 204 | + |
| 205 | +## Example usage |
| 206 | + |
| 207 | +The following query returns information about the customizable options configured for the product with a `sku` of `xyz`. |
| 208 | + |
| 209 | +**Request:** |
| 210 | + |
| 211 | +```graphql |
| 212 | +{ |
| 213 | + products(filter: {sku: {eq: "xyz"}}) { |
| 214 | + items { |
| 215 | + id |
| 216 | + name |
| 217 | + sku |
| 218 | + __typename |
| 219 | + ... on CustomizableProductInterface { |
| 220 | + options { |
| 221 | + title |
| 222 | + required |
| 223 | + sort_order |
| 224 | + option_id |
| 225 | + } |
| 226 | + } |
| 227 | + } |
| 228 | + } |
| 229 | +} |
| 230 | +``` |
| 231 | + |
| 232 | +**Response:** |
| 233 | + |
| 234 | +```json |
| 235 | +{ |
| 236 | + "data": { |
| 237 | + "products": { |
| 238 | + "items": [ |
| 239 | + { |
| 240 | + "id": 1, |
| 241 | + "name": "T-shirt", |
| 242 | + "sku": "xyz", |
| 243 | + "__typename": "SimpleProduct", |
| 244 | + "options": [ |
| 245 | + { |
| 246 | + "title": "Image", |
| 247 | + "required": false, |
| 248 | + "sort_order": 1, |
| 249 | + "option_id": 1 |
| 250 | + } |
| 251 | + ] |
| 252 | + } |
| 253 | + ] |
| 254 | + } |
| 255 | + } |
| 256 | +} |
| 257 | +``` |
0 commit comments