|
| 1 | +--- |
| 2 | +group: graphql |
| 3 | +title: Bundle product data types |
| 4 | +--- |
| 5 | + |
| 6 | +The `BundleProduct` data type implements the following interfaces: |
| 7 | + |
| 8 | +- `ProductInterface` |
| 9 | +- `PhysicalProductInterface` |
| 10 | +- `CustomizableProductInterface` |
| 11 | + |
| 12 | +Attributes that are specific to bundle products can be used when performing a [`products`]({{page.baseurl}}/graphql/queries/products.html) query. |
| 13 | + |
| 14 | +## BundleProduct object |
| 15 | + |
| 16 | +The `BundleProduct` object contains the following attributes: |
| 17 | + |
| 18 | +Attribute | Type | Description |
| 19 | +--- | --- | --- |
| 20 | +`dynamic_price` | Boolean | Indicates whether the bundle product has a dynamic price |
| 21 | +`dynamic_sku` | Boolean | Indicates whether the bundle product has a dynamic SKU |
| 22 | +`dynamic_weight` | Boolean | Indicates whether the bundle product has a dynamically calculated weight |
| 23 | +`items` | [BundleItem] | An array containing information about individual bundle items |
| 24 | +`price_view` | PriceViewEnum | One of PRICE_RANGE or AS_LOW_AS |
| 25 | +`ship_bundle_items` | ShipBundleItemsEnum | Indicates whether to ship bundle items TOGETHER or SEPARATELY |
| 26 | + |
| 27 | +## BundleItem object |
| 28 | + |
| 29 | +The `BundleItem` object contains the following attributes: |
| 30 | + |
| 31 | +Attribute | Type | Description |
| 32 | +--- | --- | --- |
| 33 | +`option_id` | Int | An ID assigned to each type of item in a bundle product |
| 34 | +`options` | [BundleItemOption] | An array of additional options for this bundle item |
| 35 | +`position` | Int | The relative position of this item compared to the other bundle items |
| 36 | +`required` | Boolean | Indicates whether the item must be included in the bundle |
| 37 | +`sku` | String | The SKU of the bundle product |
| 38 | +`title` | String | The display name of the item |
| 39 | +`type` | String | The input type that the customer uses to select the item. Examples include radio button and checkbox. |
| 40 | + |
| 41 | +## BundleItemOption object |
| 42 | + |
| 43 | +The `BundleItemOption` object contains the following attributes: |
| 44 | + |
| 45 | +Attribute | Type | Description |
| 46 | +--- | --- | --- |
| 47 | +`can_change_quantity` | Boolean | Indicates whether the customer can change the number of items for this option |
| 48 | +`id` | Int | The ID assigned to the bundled item option |
| 49 | +`is_default` | Boolean | Indicates whether this option is the default option |
| 50 | +`label` | String | The text that identifies the bundled item option |
| 51 | +`position` | Int | When a bundle item contains multiple options, the relative position of this option compared to the other options |
| 52 | +`price_type` | PriceTypeEnum | One of FIXED, PERCENT, or DYNAMIC |
| 53 | +`price` | Float | The price of the selected option |
| 54 | +`product` | [ProductInterface]({{page.baseurl}}/graphql/product/product-interface.html) | Contains details about this product option |
| 55 | +`qty` | Float | Deprecated. Use `quantity` instead |
| 56 | +`quantity` | Float | Indicates the quantity of this specific bundle item |
| 57 | +`uid` | ID! | A string that encodes option details |
| 58 | + |
| 59 | +## Sample Query |
| 60 | + |
| 61 | +The following query returns information about bundle product `24-WG080`, which is defined in the sample data. |
| 62 | + |
| 63 | +```graphql |
| 64 | +{ |
| 65 | + products(filter: {sku: |
| 66 | + {eq: "24-WG080"} |
| 67 | + }) |
| 68 | + { |
| 69 | + items{ |
| 70 | + sku |
| 71 | + __typename |
| 72 | + id |
| 73 | + name |
| 74 | + ... on BundleProduct { |
| 75 | + dynamic_sku |
| 76 | + dynamic_price |
| 77 | + dynamic_weight |
| 78 | + price_view |
| 79 | + ship_bundle_items |
| 80 | + items { |
| 81 | + option_id |
| 82 | + title |
| 83 | + required |
| 84 | + type |
| 85 | + position |
| 86 | + sku |
| 87 | + options { |
| 88 | + id |
| 89 | + uid |
| 90 | + quantity |
| 91 | + position |
| 92 | + is_default |
| 93 | + price |
| 94 | + price_type |
| 95 | + can_change_quantity |
| 96 | + label |
| 97 | + product { |
| 98 | + id |
| 99 | + name |
| 100 | + sku |
| 101 | + __typename |
| 102 | + } |
| 103 | + } |
| 104 | + } |
| 105 | + } |
| 106 | + } |
| 107 | + } |
| 108 | +} |
| 109 | +``` |
| 110 | + |
| 111 | +{% collapsible Response %} |
| 112 | + |
| 113 | +```json |
| 114 | +{ |
| 115 | + "data": { |
| 116 | + "products": { |
| 117 | + "items": [ |
| 118 | + { |
| 119 | + "sku": "24-WG080", |
| 120 | + "__typename": "BundleProduct", |
| 121 | + "id": 46, |
| 122 | + "name": "Sprite Yoga Companion Kit", |
| 123 | + "dynamic_sku": true, |
| 124 | + "dynamic_price": true, |
| 125 | + "dynamic_weight": true, |
| 126 | + "price_view": "PRICE_RANGE", |
| 127 | + "ship_bundle_items": "TOGETHER", |
| 128 | + "items": [ |
| 129 | + { |
| 130 | + "option_id": 1, |
| 131 | + "title": "Sprite Stasis Ball", |
| 132 | + "required": true, |
| 133 | + "type": "radio", |
| 134 | + "position": 1, |
| 135 | + "sku": "24-WG080", |
| 136 | + "options": [ |
| 137 | + { |
| 138 | + "id": 1, |
| 139 | + "uid": "YnVuZGxlLzEvMS8x", |
| 140 | + "quantity": 1, |
| 141 | + "position": 1, |
| 142 | + "is_default": true, |
| 143 | + "price": 0, |
| 144 | + "price_type": "FIXED", |
| 145 | + "can_change_quantity": true, |
| 146 | + "label": "Sprite Stasis Ball 55 cm", |
| 147 | + "product": { |
| 148 | + "id": 26, |
| 149 | + "name": "Sprite Stasis Ball 55 cm", |
| 150 | + "sku": "24-WG081-blue", |
| 151 | + "__typename": "SimpleProduct" |
| 152 | + } |
| 153 | + }, |
| 154 | + { |
| 155 | + "id": 2, |
| 156 | + "uid": "YnVuZGxlLzEvMi8x", |
| 157 | + "quantity": 1, |
| 158 | + "position": 2, |
| 159 | + "is_default": false, |
| 160 | + "price": 0, |
| 161 | + "price_type": "FIXED", |
| 162 | + "can_change_quantity": true, |
| 163 | + "label": "Sprite Stasis Ball 65 cm", |
| 164 | + "product": { |
| 165 | + "id": 29, |
| 166 | + "name": "Sprite Stasis Ball 65 cm", |
| 167 | + "sku": "24-WG082-blue", |
| 168 | + "__typename": "SimpleProduct" |
| 169 | + } |
| 170 | + }, |
| 171 | + { |
| 172 | + "id": 3, |
| 173 | + "uid": "YnVuZGxlLzEvMy8x", |
| 174 | + "quantity": 1, |
| 175 | + "position": 3, |
| 176 | + "is_default": false, |
| 177 | + "price": 0, |
| 178 | + "price_type": "FIXED", |
| 179 | + "can_change_quantity": true, |
| 180 | + "label": "Sprite Stasis Ball 75 cm", |
| 181 | + "product": { |
| 182 | + "id": 32, |
| 183 | + "name": "Sprite Stasis Ball 75 cm", |
| 184 | + "sku": "24-WG083-blue", |
| 185 | + "__typename": "SimpleProduct" |
| 186 | + } |
| 187 | + } |
| 188 | + ] |
| 189 | + }, |
| 190 | + { |
| 191 | + "option_id": 2, |
| 192 | + "title": "Sprite Foam Yoga Brick", |
| 193 | + "required": true, |
| 194 | + "type": "radio", |
| 195 | + "position": 2, |
| 196 | + "sku": "24-WG080", |
| 197 | + "options": [ |
| 198 | + { |
| 199 | + "id": 4, |
| 200 | + "uid": "YnVuZGxlLzIvNC8x", |
| 201 | + "quantity": 1, |
| 202 | + "position": 1, |
| 203 | + "is_default": true, |
| 204 | + "price": 0, |
| 205 | + "price_type": "FIXED", |
| 206 | + "can_change_quantity": true, |
| 207 | + "label": "Sprite Foam Yoga Brick", |
| 208 | + "product": { |
| 209 | + "id": 21, |
| 210 | + "name": "Sprite Foam Yoga Brick", |
| 211 | + "sku": "24-WG084", |
| 212 | + "__typename": "SimpleProduct" |
| 213 | + } |
| 214 | + } |
| 215 | + ] |
| 216 | + }, |
| 217 | + { |
| 218 | + "option_id": 3, |
| 219 | + "title": "Sprite Yoga Strap", |
| 220 | + "required": true, |
| 221 | + "type": "radio", |
| 222 | + "position": 3, |
| 223 | + "sku": "24-WG080", |
| 224 | + "options": [ |
| 225 | + { |
| 226 | + "id": 5, |
| 227 | + "uid": "YnVuZGxlLzMvNS8x", |
| 228 | + "quantity": 1, |
| 229 | + "position": 1, |
| 230 | + "is_default": true, |
| 231 | + "price": 0, |
| 232 | + "price_type": "FIXED", |
| 233 | + "can_change_quantity": true, |
| 234 | + "label": "Sprite Yoga Strap 6 foot", |
| 235 | + "product": { |
| 236 | + "id": 33, |
| 237 | + "name": "Sprite Yoga Strap 6 foot", |
| 238 | + "sku": "24-WG085", |
| 239 | + "__typename": "SimpleProduct" |
| 240 | + } |
| 241 | + }, |
| 242 | + { |
| 243 | + "id": 6, |
| 244 | + "uid": "YnVuZGxlLzMvNi8x", |
| 245 | + "quantity": 1, |
| 246 | + "position": 2, |
| 247 | + "is_default": false, |
| 248 | + "price": 0, |
| 249 | + "price_type": "FIXED", |
| 250 | + "can_change_quantity": true, |
| 251 | + "label": "Sprite Yoga Strap 8 foot", |
| 252 | + "product": { |
| 253 | + "id": 34, |
| 254 | + "name": "Sprite Yoga Strap 8 foot", |
| 255 | + "sku": "24-WG086", |
| 256 | + "__typename": "SimpleProduct" |
| 257 | + } |
| 258 | + }, |
| 259 | + { |
| 260 | + "id": 7, |
| 261 | + "uid": "YnVuZGxlLzMvNy8x", |
| 262 | + "quantity": 1, |
| 263 | + "position": 3, |
| 264 | + "is_default": false, |
| 265 | + "price": 0, |
| 266 | + "price_type": "FIXED", |
| 267 | + "can_change_quantity": true, |
| 268 | + "label": "Sprite Yoga Strap 10 foot", |
| 269 | + "product": { |
| 270 | + "id": 35, |
| 271 | + "name": "Sprite Yoga Strap 10 foot", |
| 272 | + "sku": "24-WG087", |
| 273 | + "__typename": "SimpleProduct" |
| 274 | + } |
| 275 | + } |
| 276 | + ] |
| 277 | + }, |
| 278 | + { |
| 279 | + "option_id": 4, |
| 280 | + "title": "Sprite Foam Roller", |
| 281 | + "required": true, |
| 282 | + "type": "radio", |
| 283 | + "position": 4, |
| 284 | + "sku": "24-WG080", |
| 285 | + "options": [ |
| 286 | + { |
| 287 | + "id": 8, |
| 288 | + "uid": "YnVuZGxlLzQvOC8x", |
| 289 | + "quantity": 1, |
| 290 | + "position": 1, |
| 291 | + "is_default": true, |
| 292 | + "price": 0, |
| 293 | + "price_type": "FIXED", |
| 294 | + "can_change_quantity": true, |
| 295 | + "label": "Sprite Foam Roller", |
| 296 | + "product": { |
| 297 | + "id": 22, |
| 298 | + "name": "Sprite Foam Roller", |
| 299 | + "sku": "24-WG088", |
| 300 | + "__typename": "SimpleProduct" |
| 301 | + } |
| 302 | + } |
| 303 | + ] |
| 304 | + } |
| 305 | + ] |
| 306 | + } |
| 307 | + ] |
| 308 | + } |
| 309 | + } |
| 310 | +} |
| 311 | +``` |
| 312 | + |
| 313 | +{% endcollapsible %} |
| 314 | + |
| 315 | +## Related topics |
| 316 | + |
| 317 | +- [addBundleProductsToCart mutation]({{page.baseurl}}/graphql/mutations/add-bundle-products.html) |
0 commit comments