Attributes Queries

Access product attributes used for variant classification.

Attribute — Returns a single attribute by id

Example Query:

query GetAttribute($id: ID!) {
  Attribute(id: $id) {
    id
    label
    option {
      id
      label
    }
  }
}

Example Result:

{
  "data": {
    "Attribute": {
      "id": 5001,
      "label": "Red",
      "option": {
        "id": 10001,
        "label": "Color"
      }
    }
  }
}

Attributes — Returns a list of attributes with sorting and filters

Example Query:

query Attributes(
  $where: QueryAttributesWhereWhereConditions,
  $orderBy: [QueryAttributesOrderByOrderByClause!]
) {
  Attributes(
    where: $where,
    orderBy: $orderBy
  ) {
    data {
      id
      label
      option { id label }
    }
  }
}

Example Variables:

{
  "where": {
    "AND": [
      { "column": "OPTION_ID", "operator": "EQ", "value": 10001 }
    ]
  },
  "orderBy": [
    { "column": "LABEL", "order": "ASC" }
  ]
}

Available fields

FieldTypeDescription
idIntUnique identifier.
labelStringName of the attribute (e.g. "Red", "Large").
optionOptionThe Option this attribute belongs to (e.g. Color).

Data Types

ProductAttribute

FieldTypeDescription
idIntProduct attribute ID.
option_idIntOption ID.
attributeAttributeThe attribute details.

AttributeVariant

FieldTypeDescription
idIDUnique identifier.
attribute_idIDID of the attribute.
option_idIntID of the option (e.g. Color, Size).
variant_idIDID of the variant.
attributeAttributeThe attribute details.
optionOptionThe option this attribute belongs to.

AttributeVariantInput

FieldTypeDescription
idIDAttribute variant ID (for updates).
attributeAttributeInputAttribute details.

Filters

FieldExample
id{ "column": "ID", "operator": "EQ", "value": 5001 }
label{ "column": "LABEL", "operator": "LIKE", "value": "%Red%" }
option_id{ "column": "OPTION_ID", "operator": "EQ", "value": 10001 }