Magento 2.4.6 REST API – Bundle Product Cart Issue
I'm using the Magento 2.4.6 REST API to add a bundle product to the guest cart.
Create Quote
POST /rest/V1/guest-carts
Response (quote_id):
test
Add Bundle Product to Cart
POST /rest/V1/guest-carts/{{quote_id}}/items
Payload:
{
"cartItem": {
"sku": "MK-bundle",
"qty": 1,
"quote_id": "test",
"product_option": {
"extension_attributes": {
"bundle_options": [
{ "option_id": 15, "option_qty": 1, "option_selections": [63] },
{ "option_id": 16, "option_qty": 1, "option_selections": [66] }
]
}
}
}
}
Response: Product added successfully with correct data.
Issue: When trying to fetch cart items or totals using:
GET /rest/V1/guest-carts/{{quote_id}}/items
GET /rest/V1/guest-carts/{{quote_id}}/totals
I get this error:
"The product that was requested doesn't exist. Verify the product and try again." Since the item is added successfully, why is this error occurring when fetching cart data? How can I correctly retrieve the cart items?
how to solve this or how we can add bundle products in the cart ?
1 Answer 1
To add a bundle product to a guest cart in Magento 2 via REST API:
Create a guest cart
POST /rest/V1/guest-carts → returns cartId.
Get bundle options
GET /rest/V1/bundle-products/{sku}/options/all
→ use option_id and product_links.id from response.
Add bundle to cart
POST /rest/V1/guest-carts/{cartId}/items
{
"cartItem": {
"quote_id": "{cartId}",
"sku": "MK-bundle",
"qty": 1,
"product_option": {
"extension_attributes": {
"bundle_options": [
{ "option_id": 15, "option_qty": 1, "option_selections": [63] },
{ "option_id": 16, "option_qty": 1, "option_selections": [66] }
]
}
}
}
}
Use GET /rest/V1/guest-carts/{cartId}/items and /totals
Ensure all option_id and option_selections are correct—errors occur if they’re missing or invalid.
Explore related questions
See similar questions with these tags.