Skip to content

cartBundleAdd

Mutationin Cart

Add a main product and the extras chosen with it as a bundle, in one call. The extras are linked to the main line and get the bundle's discount for as long as it is in the cart. The result is the same as cartLineItemsAdd's.

Arguments

ArgumentTypeDescription
idID
versionString
mainCartLineItemAddInput!
extras[CartAddOnInput!]!

Returns

CartLineItemsAddResponse!

FieldTypeDescription
cartCartCart information after line items are added
lineResults[CartLineItemAddResult!]One result per requested line, in the order requested: added, or why not. Lines that can be added are added even when others cannot. Null when the request failed as a whole, which cartErrors then says.
addedQuantityIntHow many items were added in total, counted by quantity.
addedAmountMoneyWhat the added lines add to the cart total. Null when the request failed as a whole.
cartErrors[CartLineItemsAddError!]Error details if line item addition failed

Example

mutation CartBundleAdd(
$id: ID
$version: String
$main: CartLineItemAddInput!
$extras: [CartAddOnInput!]!
) {
cartBundleAdd(id: $id, version: $version, main: $main, extras: $extras) {
cart {
id
version
createdAt
lastModifiedAt
currency
customerEmail
isGuest
totalQuantity
deliveryRemarks
vatNumber
purchaseOrderNumber
deliverySplit
requestedDeliveryDate
earliestCompleteDeliveryDate
name
defaultName
status
}
lineResults {
sku
quantity
failure
message
}
addedQuantity
addedAmount {
centAmount
currency
}
cartErrors {
__typename
... on ValidationError {
message
}
... on CartError {
message
code
}
}
}
}

The query selects the return type's fields two levels deep; pick the ones you need. The response shows its shape with placeholder values.

Served by

@evolve-framework/commercetoolsResolved
@evolve-framework/medusaResolved
@evolve-framework/sfccResolved

Used by

The storefront packages that send it, in these GraphQL documents: