ProductOption
Describes a product option.
Type Definition
type ProductOption {
isForCombinedListing: Boolean
handle: String
sortOrder: Int
title: String
taxonomyAttributeId: Int
taxonomyAttributeHandle: String
taxonomyAttribute: ProductTaxonomyAttribute
values: [ProductOptionValue]
selectedValue: ProductOptionValue
}
Fields
Field | Type | Nullable | Description | Related Type |
---|---|---|---|---|
isForCombinedListing | Boolean | Yes | Returns whether this option is for a combined listing. | - |
handle | String | Yes | Returns the handle. | - |
sortOrder | Int | Yes | Returns the sort order. | - |
title | String | Yes | Returns the title. | - |
taxonomyAttributeId | Int | Yes | Returns the taxonomy attribute ID. | - |
taxonomyAttributeHandle | String | Yes | Returns the taxonomy attribute handle. | - |
taxonomyAttribute | ProductTaxonomyAttribute | Yes | Returns the related taxonomy attribute for this option. | ProductTaxonomyAttribute |
values | [ProductOptionValue] | Yes | Returns the values available for this option. | [ProductOptionValue] |
selectedValue | ProductOptionValue | Yes | Returns the selected value for this option. | ProductOptionValue |
Relationships
- taxonomyAttribute: Links this product option to a
ProductTaxonomyAttribute
object, providing additional metadata about the taxonomy classification of the option. - values: An array of
ProductOptionValue
objects representing all possible values this option can take. - selectedValue: A single
ProductOptionValue
representing the currently selected value for this option.
These relationships allow traversal from a product option to its taxonomy details and possible or selected values, enabling rich querying of product configurations.
Usage Examples
Basic Query
{
productOption {
isForCombinedListing
handle
sortOrder
title
taxonomyAttributeId
}
}
Field Selection
{
productOption {
title
handle
values {
id
label
}
selectedValue {
id
label
}
}
}
Nested Queries
{
productOption {
title
taxonomyAttribute {
id
name
description
}
values {
id
label
sortOrder
}
}
}
Filtering and Sorting
Filtering and sorting can be applied when querying collections of product options or their values. For example, to fetch product options sorted by sortOrder
:
{
productOptions(sortBy: SORT_ORDER_ASC) {
title
sortOrder
values {
label
}
}
}
Note: Actual filtering and sorting arguments depend on the schema’s query definitions and are not defined directly on the ProductOption
type fields.
Implements
This type does not explicitly implement any interfaces.
Connections
The ProductOption
type connects to:
ProductTaxonomyAttribute
via thetaxonomyAttribute
field.ProductOptionValue
via thevalues
andselectedValue
fields.
These connections enable querying related taxonomy metadata and option values seamlessly.
Related Types
- ProductTaxonomyAttribute: Provides taxonomy classification details for product options.
- ProductOptionValue: Represents individual selectable values within a product option.
Best Practices
- When querying product options, select only the fields you need to optimize response size and performance.
- Use the
values
field to retrieve all possible values for an option, andselectedValue
to identify the current selection. - Leverage the
taxonomyAttribute
relationship to enrich product options with taxonomy metadata when needed. - For sorting or filtering product options, use query-level arguments where supported rather than client-side filtering.
Notes
- All fields in
ProductOption
are optional and may returnnull
if data is unavailable. - The API currently requires no authentication, but this may change in future versions; design your client to handle authentication gracefully.
- Nested queries involving related types like
ProductTaxonomyAttribute
andProductOptionValue
can impact performance; use them judiciously. - There are no computed or derived fields explicitly defined on this type.
- No field arguments are defined on
ProductOption
fields.
Last updated on