Options Queries

Retrieve product options (e.g., Color, Size) and their possible values.

Option — Returns a single option by id

Example Query:

query GetOption($id: ID!) {
  Option(id: $id) {
    id
    label
    weight
    attributes {
      paginatorInfo { total }
      data { id label }
    }
  }
}

Example Result:

{
  "data": {
    "Option": {
      "id": 10001,
      "label": "Color",
      "weight": 0,
      "attributes": {
        "paginatorInfo": { "total": 3 },
        "data": [
          { "id": 5001, "label": "Red" },
          { "id": 5002, "label": "Blue" },
          { "id": 5003, "label": "Green" }
        ]
      }
    }
  }
}

Options — Returns a list of options with sorting and filters

Example Query:

query Options(
  $where: QueryOptionsWhereWhereConditions,
  $orderBy: [QueryOptionsOrderByOrderByClause!]
) {
  Options(
    where: $where,
    orderBy: $orderBy
  ) {
    id
    label
    weight
  }
}

Example Variables:

{
  "where": {
    "AND": [
      { "column": "LABEL", "operator": "LIKE", "value": "%Col%" }
    ]
  },
  "orderBy": [
    { "column": "ID", "order": "ASC" }
  ]
}

Available fields

FieldTypeDescription
idIntUnique identifier.
labelStringName of the option (e.g. "Color").
weightIntDisplay order weight.
attributes[Attribute]Values associated with this option.

Data Types

OptionCreateInput

FieldTypeDescription
idIDOption ID (for updates).
labelString!Option name (required).

Filters

FieldExample
id{ "column": "ID", "operator": "EQ", "value": 10001 }
label{ "column": "LABEL", "operator": "LIKE", "value": "%Size%" }