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 miscellaneous
The ID of the attribute.
Attribute.privateMetadata
● [MetadataItem!]!
non-null object miscellaneous
List of private metadata items. Requires staff permissions to access.
Attribute.privateMetafield
● String
scalar miscellaneous
A single key from private metadata. Requires staff permissions to access.
Tip: Use GraphQL aliases to fetch multiple keys.
Added in Saleor 3.3
Attribute.privateMetafield.key
●String!
non-null scalar miscellaneous
Attribute.privateMetafields
● Metadata
scalar miscellaneous
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.
Attribute.privateMetafields.keys
●[String!]
list scalar miscellaneous
Attribute.metadata
● [MetadataItem!]!
non-null object miscellaneous
List of public metadata items. Can be accessed without permissions.
Attribute.metafield
● String
scalar miscellaneous
A single key from public metadata.
Tip: Use GraphQL aliases to fetch multiple keys.
Added in Saleor 3.3
Attribute.metafield.key
●String!
non-null scalar miscellaneous
Attribute.metafields
● Metadata
scalar miscellaneous
Public metadata. Use
Added in Saleor 3.3keys
to control which fields you want to include. The default is to include everything.
Attribute.metafields.keys
●[String!]
list scalar miscellaneous
Attribute.inputType
● AttributeInputTypeEnum
enum attributes
The input type to use for entering attribute values in the dashboard.
Attribute.entityType
● AttributeEntityTypeEnum
enum attributes
The entity type which can be used as a reference.
Attribute.name
● String
scalar miscellaneous
Name of an attribute displayed in the interface.
Attribute.slug
● String
scalar miscellaneous
Internal representation of an attribute name.
Attribute.type
● AttributeTypeEnum
enum attributes
The attribute type.
Attribute.unit
● MeasurementUnitsEnum
enum miscellaneous
The unit of attribute values.
Attribute.choices
● AttributeValueCountableConnection
object attributes
List of attribute's values.
Attribute.choices.sortBy
●AttributeChoicesSortingInput
input attributesSort attribute choices.
Attribute.choices.filter
● AttributeValueFilterInput
input attributes
Filtering options for attribute choices.
Attribute.choices.before
● String
scalar miscellaneous
Return the elements in the list that come before the specified cursor.
Attribute.choices.after
● String
scalar miscellaneous
Return the elements in the list that come after the specified cursor.
Attribute.choices.first
● Int
scalar miscellaneous
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 miscellaneous
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 miscellaneous
Whether the attribute requires values to be passed or not.
Attribute.visibleInStorefront
● Boolean!
non-null scalar miscellaneous
Whether the attribute should be visible or not in storefront.
Attribute.filterableInStorefront
● Boolean!
deprecated non-null scalar miscellaneous
DEPRECATEDThis field will be removed in Saleor 4.0.
Whether the attribute can be filtered in storefront.
Attribute.filterableInDashboard
● Boolean!
non-null scalar miscellaneous
Whether the attribute can be filtered in dashboard.
Attribute.availableInGrid
● Boolean!
deprecated non-null scalar miscellaneous
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 miscellaneous
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 attributes
Returns translated attribute fields for the given language code.
Attribute.translation.languageCode
●LanguageCodeEnum!
non-null enum miscellaneousA language code to return the translation for attribute.
Attribute.withChoices
● Boolean!
non-null scalar miscellaneous
Flag indicating that attribute has predefined choices.
Attribute.productTypes
● ProductTypeCountableConnection!
non-null object products
A list of product types that use this attribute as a product attribute.
Attribute.productTypes.before
●String
scalar miscellaneousReturn the elements in the list that come before the specified cursor.
Attribute.productTypes.after
● String
scalar miscellaneous
Return the elements in the list that come after the specified cursor.
Attribute.productTypes.first
● Int
scalar miscellaneous
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 miscellaneous
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 products
A list of product types that use this attribute as a product variant attribute.
Attribute.productVariantTypes.before
●String
scalar miscellaneousReturn the elements in the list that come before the specified cursor.
Attribute.productVariantTypes.after
● String
scalar miscellaneous
Return the elements in the list that come after the specified cursor.
Attribute.productVariantTypes.first
● Int
scalar miscellaneous
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 miscellaneous
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 miscellaneous
External ID of this attribute.
Added in Saleor 3.10
Interfaces
Node
interface miscellaneous
An object with an ID
ObjectWithMetadata
interface miscellaneous
Returned By
attribute
query
Member Of
AssignedVariantAttribute
object ● AttributeBulkCreateResult
object ● AttributeBulkUpdateResult
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