I created a customizable option of type field in the product and now I can not add this product in the cart by api
api endpoint: /carts/{{quote_id}}/items
{ "cartItem": { "sku": "830406000000", "qty": 1, "quote_id": "3", "options": [ { "key": "1", "value": "test" } ] } }
Solved! Go to Solution.
Hello @kimvieira
parameters: { "cart_item": { "quote_id": "9", "sku": "24-MB01", "qty": 1, "productOption":{ "extensionAttributes":{ "customOptions":[ { "optionId":"1", "optionValue":"2" } ] } } } }
please check with above input.
If works then mark as solution.
Hello @kimvieira
get /V1/products/{sku}/options
by using above api you will get all options for that sku.
More info:
https://magento.stackexchange.com/questions/146095/can-i-retrieve-product-custom-options-with-magent...
if help you then mark as solution.
Hello @kimvieira
parameters: { "cart_item": { "quote_id": "9", "sku": "24-MB01", "qty": 1, "productOption":{ "extensionAttributes":{ "customOptions":[ { "optionId":"1", "optionValue":"2" } ] } } } }
please check with above input.
If works then mark as solution.
can i use optionLabel or optionTitle instead of optionId?
I need to create the same option on other products. each product will have a different id, right?
Hello @kimvieira
you can not use same option title. you must need to create custom option each product, you need to first retrieve it using api and then you need to pass option id.
Hope it will help you.
if help you then mark as a solution, so it will helpful to others.
cheers
in case I would have, for example, 3 products with the same customizable option ("custom_text" for example). who to call the api does not know the id of the attribute, but would know the name. understood. is it possible for api to get the id of the attribute using the label?
Hello @kimvieira
get /V1/products/{sku}/options
by using above api you will get all options for that sku.
More info:
https://magento.stackexchange.com/questions/146095/can-i-retrieve-product-custom-options-with-magent...
if help you then mark as solution.
tks