The REST API model has ProductVariant.Option1 .Option2 and .Option3.
The API model Variant does not have these fields.
What is the mapping between the two? Do I need to do the below (with checking for Product.Variants.nodes[].size of course)
Product.Variants.nodes[].selectedOptions[0].value
Product.Variants.nodes[].selectedOptions[1].value
Product.Variants.nodes[].selectedOptions[2].value
Hi @lkates
Yes, that’s essentially the correct mapping.
In the REST Admin API:
-
option1 first product option value
-
option2 second product option value
-
option3 third product option value
In the GraphQL Admin API, these are represented by:
variant.selectedOptions
For example:
{
"selectedOptions": [
{
"name": "Color",
"value": "Blue"
},
{
"name": "Size",
"value": "Large"
}
]
}
Maps to:
REST option1 = Blue
REST option2 = Large
REST option3 = null
So your mapping would be:
option1 selectedOptions[0].value
option2 selectedOptions[1].value
option3 selectedOptions[2].value
Hi @lkates
Thank you for your response. It’s good to know that it’s worked for you. Kindly feel free to get back to me if you need any further assistance. If helpful, please like all posts. 