2

I need to add a bundle product in cart via REST API.

Is there any sample code by which I can pass only SKU code and bundle product will add into cart.

Please help me in this.

  • Hi, any news about this question? Did you find any solution? Thanks! – Lorenzo S Mar 21 '17 at 10:55
1

In case you still need it.

Let's assume that our bundle is identified by the SKU "bundle01" and ID 123.

First of all, let's take some information from the product:

GET /products/bundle01?searchCriteria

and take note of the "extension_attributes" --> "bundle_product_options" section, particularly to the option_idfields related to your products. And take not of all the product_links --> id values related to the product.

Let's assume that we have 3 products in the bundle, with option_id 643, 644, 645 and id 704,705,706 respectively.

With all these information, here's the body to add a bundle product to your cart:

{
"cart_item": {
    "quote_id": <quote_id>,
    "sku": "bundle-01",
    "qty": 1,
    "product_option": {
    "extension_attributes": {
        "bundle_options": [{
            "option_id": 643,
            "option_qty": 1,
            "option_selections": [704]
            }, {
            "option_id": 644,
            "option_qty": 1,
            "option_selections": [705]
            }, {
            "option_id": 645,
            "option_qty": 1,
            "option_selections": [706]
            }]
        }
    }
}
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.