Attribute
Custom attribute of a product. Attributes can be assigned to products and variants at the product type level.
type Attribute implements Node, ObjectWithMetadata {
id: ID!
privateMetadata: [MetadataItem!]!
privateMetafield(key: String!): String
privateMetafields(keys: [String!]): Metadata
metadata: [MetadataItem!]!
metafield(key: String!): String
metafields(keys: [String!]): Metadata
inputType: AttributeInputTypeEnum
entityType: AttributeEntityTypeEnum
name: String
slug: String
type: AttributeTypeEnum
unit: MeasurementUnitsEnum
choices(
sortBy: AttributeChoicesSortingInput
filter: AttributeValueFilterInput
before: String
after: String
first: Int
last: Int
): AttributeValueCountableConnection
valueRequired: Boolean!
visibleInStorefront: Boolean!
filterableInStorefront: Boolean! @deprecated
filterableInDashboard: Boolean!
availableInGrid: Boolean! @deprecated
storefrontSearchPosition: Int! @deprecated
translation(languageCode: LanguageCodeEnum!): AttributeTranslation
withChoices: Boolean!
productTypes(
before: String
after: String
first: Int
last: Int
): ProductTypeCountableConnection!
productVariantTypes(
before: String
after: String
first: Int
last: Int
): ProductTypeCountableConnection!
externalReference: String
}
Fields
Attribute.id
● ID!
non-null scalar
Attribute.privateMetadata
● [MetadataItem!]!
non-null object
List of private metadata items. Requires staff permissions to access.
Attribute.privateMetafield
● String
scalar
A single key from private metadata. Requires staff permissions to access.
Tip: Use GraphQL aliases to fetch multiple keys.
Added in Saleor 3.3This API is currently in Feature Preview and can be subject to changes at later point.
Attribute.privateMetafield.key
●String!
non-null scalar
Attribute.privateMetafields
● Metadata
scalar
Private metadata. Requires staff permissions to access. Use
Added in Saleor 3.3keys
to control which fields you want to include. The default is to include everything.This API is currently in Feature Preview and can be subject to changes at later point.
Attribute.privateMetafields.keys
●[String!]
list scalar
Attribute.metadata
● [MetadataItem!]!
non-null object
List of public metadata items. Can be accessed without permissions.
Attribute.metafield
● String
scalar
A single key from public metadata.
Tip: Use GraphQL aliases to fetch multiple keys.
Added in Saleor 3.3This API is currently in Feature Preview and can be subject to changes at later point.
Attribute.metafield.key
●String!
non-null scalar
Attribute.metafields
● Metadata
scalar
Public metadata. Use
Added in Saleor 3.3keys
to control which fields you want to include. The default is to include everything.This API is currently in Feature Preview and can be subject to changes at later point.
Attribute.metafields.keys
●[String!]
list scalar
Attribute.inputType
● AttributeInputTypeEnum
enum
The input type to use for entering attribute values in the dashboard.
Attribute.entityType
● AttributeEntityTypeEnum
enum
The entity type which can be used as a reference.
Attribute.name
● String
scalar
Name of an attribute displayed in the interface.
Attribute.slug
● String
scalar
Internal representation of an attribute name.
Attribute.type
● AttributeTypeEnum
enum
The attribute type.
Attribute.unit
● MeasurementUnitsEnum
enum
The unit of attribute values.
Attribute.choices
● AttributeValueCountableConnection
object
List of attribute's values.
Attribute.choices.sortBy
●AttributeChoicesSortingInput
inputSort attribute choices.
Attribute.choices.filter
● AttributeValueFilterInput
input
Filtering options for attribute choices.
Attribute.choices.before
● String
scalar
Return the elements in the list that come before the specified cursor.
Attribute.choices.after
● String
scalar
Return the elements in the list that come after the specified cursor.
Attribute.choices.first
● Int
scalar
Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
Attribute.choices.last
● Int
scalar
Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
Attribute.valueRequired
● Boolean!
non-null scalar
Whether the attribute requires values to be passed or not.
Attribute.visibleInStorefront
● Boolean!
non-null scalar
Whether the attribute should be visible or not in storefront.
Attribute.filterableInStorefront
● Boolean!
deprecated non-null scalar
DEPRECATEDThis field will be removed in Saleor 4.0.
Whether the attribute can be filtered in storefront.
Attribute.filterableInDashboard
● Boolean!
non-null scalar
Whether the attribute can be filtered in dashboard.
Attribute.availableInGrid
● Boolean!
deprecated non-null scalar
DEPRECATEDThis field will be removed in Saleor 4.0.
Whether the attribute can be displayed in the admin product list.
Attribute.storefrontSearchPosition
● Int!
deprecated non-null scalar
DEPRECATEDThis field will be removed in Saleor 4.0.
The position of the attribute in the storefront navigation (0 by default).
Attribute.translation
● AttributeTranslation
object
Returns translated attribute fields for the given language code.
Attribute.translation.languageCode
●LanguageCodeEnum!
non-null enumA language code to return the translation for attribute.
Attribute.withChoices
● Boolean!
non-null scalar
Flag indicating that attribute has predefined choices.
Attribute.productTypes
● ProductTypeCountableConnection!
non-null object
Attribute.productTypes.before
●String
scalarReturn the elements in the list that come before the specified cursor.
Attribute.productTypes.after
● String
scalar
Return the elements in the list that come after the specified cursor.
Attribute.productTypes.first
● Int
scalar
Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
Attribute.productTypes.last
● Int
scalar
Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
Attribute.productVariantTypes
● ProductTypeCountableConnection!
non-null object
Attribute.productVariantTypes.before
●String
scalarReturn the elements in the list that come before the specified cursor.
Attribute.productVariantTypes.after
● String
scalar
Return the elements in the list that come after the specified cursor.
Attribute.productVariantTypes.first
● Int
scalar
Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
Attribute.productVariantTypes.last
● Int
scalar
Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
Attribute.externalReference
● String
scalar
External ID of this attribute.
Added in Saleor 3.10
Interfaces
Node
interface
An object with an ID
ObjectWithMetadata
interface
Returned by
attribute
query
Member of
AssignedVariantAttribute
object ● AttributeCountableEdge
object ● AttributeCreate
object ● AttributeCreated
object ● AttributeDelete
object ● AttributeDeleted
object ● AttributeReorderValues
object ● AttributeTranslatableContent
object ● AttributeTranslate
object ● AttributeUpdate
object ● AttributeUpdated
object ● AttributeValueCreate
object ● AttributeValueDelete
object ● AttributeValueUpdate
object ● PageType
object ● ProductType
object ● SelectedAttribute
object