cancel
Showing results for 
Search instead for 
Did you mean: 

Setting multiple checkbox option selections on cart item

Setting multiple checkbox option selections on cart item

hey, guys!!

 

i have a product in my store with radio and checkbox custom options. using below JSON encoded string to add that item with it's options to shopping cart within my mobile app.

 

{
  "cartItem": {
		"qty": 1,
		"sku": "margherita",
		"quote_id": 134,
		"product_option": {
      		"extension_attributes": {
        		"custom_options": [
		          {
		            "option_id": 15,
		            "option_value": 67
		            
		          },
		          {
		            "option_id": 16,
		            "option_value": 70
		            
		          },
		          {
		            "option_id": 16,
		            "option_value": 71
		            
		          }
        		]
  			}
  		}
	}
}

but cart doesn't remember all checkbox selections, only the last one - say, with option value 71 in this example (16 is checkbox option id here).

any suggestions, how i can encode options into cart item string for cart to be able to carry all checkbox option selections???

this is original blueprint cart item JSON string from magento's doc:

{
  "cartItem": {
    "item_id": 0,
    "sku": "string",
    "qty": 0,
    "name": "string",
    "price": 0,
    "product_type": "string",
    "quote_id": "string",
    "product_option": {
      "extension_attributes": {
        "custom_options": [
          {
            "option_id": "string",
            "option_value": "string",
            "extension_attributes": {
              "file_info": {
                "base64_encoded_data": "string",
                "type": "string",
                "name": "string"
              }
            }
          }
        ],
        "bundle_options": [
          {
            "option_id": 0,
            "option_qty": 0,
            "option_selections": [
              0
            ],
            "extension_attributes": {}
          }
        ],
        "downloadable_option": {
          "downloadable_links": [
            0
          ]
        },
        "giftcard_item_option": {
          "giftcard_amount": "string",
          "custom_giftcard_amount": 0,
          "giftcard_sender_name": "string",
          "giftcard_recipient_name": "string",
          "giftcard_sender_email": "string",
          "giftcard_recipient_email": "string",
          "giftcard_message": "string",
          "extension_attributes": {}
        },
        "configurable_item_options": [
          {
            "option_id": "string",
            "option_value": 0,
            "extension_attributes": {}
          }
        ]
      }
    },
    "extension_attributes": {}
  }
}