Skip to Content

ProductOptionValue

Describes a product option value.

Type Definition

type ProductOptionValue { handle: String sortOrder: Int title: String selected: Boolean taxonomyValueId: Int taxonomyValue: ProductTaxonomyValue variant: ProductVariant image: Image }

Fields

FieldTypeNullableDescriptionRelated Type
handleStringYesReturns the handle.
sortOrderIntYesReturns the sort order.
titleStringYesReturns the title.
selectedBooleanYesReturns whether this value is selected.
taxonomyValueIdIntYesReturns the taxonomy value ID.
taxonomyValueProductTaxonomyValueYesReturns the taxonomy value for this option value.ProductTaxonomyValue
variantProductVariantYesReturns the variant associated with this value.ProductVariant
imageImageYesReturns the image associated with this value.Image

Relationships

  • taxonomyValue: Links to a ProductTaxonomyValue object representing the taxonomy classification associated with this option value.
  • variant: Connects to a ProductVariant object representing a specific product variant tied to this option value.
  • image: References an Image object representing a visual depiction of this option value.

These relationships enable traversing from an option value to detailed taxonomy data, variant specifics, or visual assets.

Usage Examples

Basic Query

Fetch all available fields for a product option value:

{ productOptionValue { handle sortOrder title selected taxonomyValueId taxonomyValue { id name } variant { id sku price } image { url altText } } }

Field Selection

Retrieve only the title and selection status of a product option value:

{ productOptionValue { title selected } }

Nested Queries

Access nested objects such as the taxonomy value name and variant price within a product option value:

{ productOptionValue { title taxonomyValue { name description } variant { sku price } } }

Filtering and Sorting

Example query to fetch product option values sorted by sortOrder ascending and filtered by selected status:

{ productOptionValues(filter: { selected: true }, sort: { sortOrder: ASC }) { title sortOrder selected } }

Note: The exact filtering and sorting arguments depend on the schema’s support for such parameters on the query fields.

Implements

This type does not explicitly implement any interfaces.

Connections

ProductOptionValue is typically accessed as part of a ProductOption object through the selectedValue field.

  • ProductTaxonomyValue: Represents taxonomy classifications linked to the option value.
  • ProductVariant: Represents specific product variants associated with the option value.
  • Image: Represents images related to the option value.

Best Practices

  • When querying ProductOptionValue, select only the fields you need to optimize query performance.
  • Use nested queries to fetch related objects (taxonomyValue, variant, image) in a single request to reduce round trips.
  • Apply filtering and sorting on collections of option values where supported to efficiently retrieve relevant data.
  • Handle nullable fields gracefully in your client code, as many fields are optional.
  • Use the selected field to determine the currently selected option value in UI components.

Notes

  • The sortOrder field can be used to present option values in a consistent order in user interfaces.
  • The handle field provides a URL-friendly identifier useful for routing or linking.
  • The taxonomyValueId is a numeric identifier that can be used for backend integrations or lookups.
  • The selected field indicates whether this option value is currently chosen, useful for state management.
  • The API currently requires no authentication, but this may change in future versions. Plan your integration accordingly.
Last updated on