Skip to content

Magento 2 rest API add bundle product in the cart

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 ?