cancel
Showing results for 
Search instead for 
Did you mean: 

how can i add configurable product and bundle product to cart using POST body

how can i add configurable product and bundle product to cart using POST body

What will be the POST request body to add configurable product and bundle product into cart ?

 

for example to add simple product to cart object is like :

var cart = {
"cartItem": {
"sku": "24-MB04",
"quoteId": "2a76a68d555581e702cb8af16546cc61",
"qty": 1
}
}

 

but how to add configurable product and bundle product ? what will be the cart object look like ?

 

Tags (2)
1 REPLY

Re: how can i add configurable product and bundle product to cart using POST body

okey I  found the solution Smiley Happy

 

var cart = {
"cartItem": {
//"item_id": 19,
"sku": "MH01",
"qty": 10,
"quote_id": "3",
"product_option": {
"extension_attributes": {
"configurable_item_options": [
{
"option_id": "90",
"option_value": 49
},
{
"option_id": "137",
"option_value": 168
}
]
}
}
}
}

 

 

and for bundle product

 

var data = {
    "cartItem":
              {
                "sku": "24-WG080",
                "qty": 1,
                "quote_id": "3",
                "product_option": {
                  "extension_attributes": {
                    "bundle_options": [
                      {
                        "option_id": 1,
                        "option_qty": 1,
                        "option_selections": [
                          1
                        ]
                      },
                      {
                        "option_id": 2,
                        "option_qty": 1,
                        "option_selections": [
                          4
                        ]
                      },
                      {
                        "option_id": 3,
                        "option_qty": 1,
                        "option_selections": [
                          5
                        ]
                      },
                      {
                        "option_id": 4,
                        "option_qty": 1,
                        "option_selections": [
                          8
                        ]
                      }
                    ]
                  }
                }
              }
            }

Tags (1)