cancel
Showing results for 
Search instead for 
Did you mean: 

Api Rest does not return Custom Options in Cart Item

Api Rest does not return Custom Options in Cart Item

Magento 2.3.5-p1 

Api Rest does not return Custom Options in Cart Item

I use an integration that retrieves the items in the shopping cart but the returned items do not show the custom item option.
If I use swagger to check with
quoteCartItemRepositoryV1 (Interface CartItemRepositoryInterface)
GET / V1 / carts / {cartId} / items

[
  {
    "item_id": 38175,
    "sku": "D15",
    "qty": 2,
    "name": "10x15 digital media",
    "price": 0.7,
    "product_type": "simple",
    "quote_id": "30333",
    "product_option": {
      "extension_attributes": {
        "custom_options": [
          {
            "option_id": "5",
            "option_value": "360504_1_504"
          }
        ]
      }
    }
  }, ...

But
quoteCartRepositoryV1 (Interface CartRepositoryInterface)
GET / V1 / carts / {cartId}
I get:

{
"id": 30333,
"created_at": "2020-10-17 15:21:27",
"updated_at": "2020-10-18 14:55:06",
"is_active": true,
"is_virtual": false,
"items": [
{
"item_id": 38175,
"sku": "D15",
"qty": 2,
"name": "10x15 digital media",
"price": 0.7,
"product_type": "simple",
"quote_id": "30333"
}, ...

Does anyone have any idea how to get custom_options in this last call, as I have to check its value to determine if the item should be deleted, and the use of two api flames would have a very high cost in time.

1 REPLY 1

Re: Api Rest does not return Custom Options in Cart Item

Hi @mordente 

 

To get cart items with all option, please try below rest api:

Method: GET
Url:  /V1/carts/mine/items
Token: Customer token

It may help you!
Problem Solved? Please click on 'kudos' & Accept as Solution!

Problem solved? Click Accept as Solution!