0

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 ?

PЯINCƎ
11.8k3 gold badges27 silver badges85 bronze badges
asked Jun 23 at 12:58

1 Answer 1

0

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.

answered Jun 23 at 21:00

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.