is the selectedOptions field on product variant ordered by option position?

On the admin-graphql API the Product Variant graphql object has a field selectedoptions ProductVariant - GraphQL Admin

this field returns an array.

Is the array sorted by the option positions? Product - GraphQL Admin

I.e. if the product has options Size, Color,

will selectedoptions on Product Variant always return an array with Size first, then Color?

Hi @sengming

The selectedoptions field returns an array sorted according to the product option’s position. The order of the selectedoptions matches the position set for each option

1 Like

Thanks @AMaL do you have any references for this? I can’t seem to find it on the documentation.

I have also not seen a reference document. I confirmed this by changing the order of the product options in the query and running it.

1 Like