I'm trying to retrieve orders from the REST API in Magento Enterprise 2.3.1, and that's easy enough with endpoints like /rest/default/V1/orders, but while I can see the values for custom options of the items in the order, I can't see their labels. For example:
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "3730",
"option_value": "Some text value."
},
{
"option_id": "3731",
"option_value": ""
}
]
}
}
It's great that I can see that for one of the custom options, the customer said "Some text value.", but I'd really like to know what it was they were responding to. What I'd expect to see for each custom option is something like:
{
"option_id": "3728",
"option_label": "What's your favorite Star Trek ship?"
"option_value": "U.S.S. Excelsior"
}
So far, any time I can find a way to load an order via the REST API, it is returned this way, and I don't see any other way to get the custom option label.
It's hard to believe I'm the first person to come across this - am I just missing something obvious?
-
Hello @mike did you got the above solution ?Tirth Patel– Tirth Patel2019年11月19日 05:58:12 +00:00Commented Nov 19, 2019 at 5:58
-
No, as of yet I have no idea. I've been working on some other stuff though, and need to get back to this.Mike– Mike2020年01月09日 12:59:41 +00:00Commented Jan 9, 2020 at 12:59
-
Hello @mike Have you got the solution?Chirag Prajapati– Chirag Prajapati2020年04月29日 10:25:22 +00:00Commented Apr 29, 2020 at 10:25
-
I haven't revisited this in a while, but I haven't seen anything about it, either.Mike– Mike2020年05月01日 18:31:00 +00:00Commented May 1, 2020 at 18:31
-
Any update on this? Did you get this resolved?Ross Robertson– Ross Robertson2020年09月08日 14:59:55 +00:00Commented Sep 8, 2020 at 14:59
1 Answer 1
You can retrieve the option labels from the catalog product endpoint like this:
GET /rest/default/V1/products/{sku}/options/{optionId}
The label will be returned in the response under title.