0

This is on Magento official document

http://devdocs.magento.com/guides/v2.2/get-started/order-tutorial/order-add-items.html

magento-host/rest/default/V1/carts/mine/items

parameters

{
  "cartItem": {
    "sku": "MH01",
    "qty": 1,
    "quote_id":  4,
    "product_option": {
      "extension_attributes": {
        "configurable_item_options": [
          {
            "option_id": "93",
            "option_value": 52
          },
          {
            "option_id": "141",
            "option_value": 168
          }
        ]
      }
    },
    "extension_attributes": {}
  }
}

Show response "message": "You need to choose options for your item.",

  • Seems in your magento don't have 168 attribute for color. In my system it's showing 147. – Pushpendra Singh Oct 12 '17 at 7:12
2

Check attribute id which you are using in api is valid or not.

 {
  "cartItem": {
    "sku": "MH10",
    "qty": 1,
    "quote_id": "25",
    "product_type" : "configurable",
    "product_option": {
      "extension_attributes": {
        "configurable_item_options": [
          {
            "option_id": "93",
            "option_value": 51
          },
          {
            "option_id": "147",
            "option_value": 169
          }
        ]
      }
    }
  }
}

You can use above code for configurable product add in cart. It's working well in my side.

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.