GraphQL module file – vendor/magento/module-bundle-graph-ql/etc/schema.graphqls
Request data – input object that defines which bundle products to add to the cart
mutation {
addBundleProductsToCart(
input: {
cart_id: "890ydb87bd7b1564trt4564hjgjk8hjk9hiy"
cart_items: [
{
data: {
sku: "24-WG080"
quantity: 1
}
bundle_options: [
{
id: 1
quantity: 1
value: [
"2"
]
},
{
id: 2
quantity: 2
value: [
"4"
]
},
{
id: 3
quantity: 1
value: [
"7"
]
},
{
id: 4
quantity: 1
value: [
"8"
]
}
]
},
]
}) {
cart {
items {
uid
quantity
product {
sku
}
... on BundleCartItem {
bundle_options {
uid
label
type
values {
id
label
price
quantity
}
}
}
}
}
}
}
Responce Data:
{
"data": {
"addBundleProductsToCart": {
"cart": {
"items": [
{
"uid": "MjI=",
"quantity": 1,
"product": {
"sku": "WSH12"
}
},
{
"uid": "MjQ=",
"quantity": 3,
"product": {
"sku": "24-WB01"
}
},
{
"uid": "MzI=",
"quantity": 1,
"product": {
"sku": "24-WG080"
},
"bundle_options": [
{
"uid": "YnVuZGxlLzE=",
"label": "Sprite Stasis Ball",
"type": "radio",
"values": [
{
"id": 2,
"label": "Sprite Stasis Ball 65 cm",
"price": 27,
"quantity": 1
}
]
},
{
"uid": "YnVuZGxlLzI=",
"label": "Sprite Foam Yoga Brick",
"type": "radio",
"values": [
{
"id": 4,
"label": "Sprite Foam Yoga Brick",
"price": 5,
"quantity": 2
}
]
},
{
"uid": "YnVuZGxlLzM=",
"label": "Sprite Yoga Strap",
"type": "radio",
"values": [
{
"id": 7,
"label": "Sprite Yoga Strap 10 foot",
"price": 21,
"quantity": 1
}
]
},
{
"uid": "YnVuZGxlLzQ=",
"label": "Sprite Foam Roller",
"type": "radio",
"values": [
{
"id": 8,
"label": "Sprite Foam Roller",
"price": 19,
"quantity": 1
}
]
}
]
}
]
}
}
}
}