Skip to main content
Version: 3.x

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
}
Expand ▼

Fields

Attribute.id ● ID! non-null scalar

The ID of the attribute.

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.3
Attribute.privateMetafield.key ● String! non-null scalar

Attribute.privateMetafields ● Metadata scalar

Private metadata. Requires staff permissions to access. Use keys to control which fields you want to include. The default is to include everything.

Added in Saleor 3.3
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.3
Attribute.metafield.key ● String! non-null scalar

Attribute.metafields ● Metadata scalar

Public metadata. Use keys to control which fields you want to include. The default is to include everything.

Added in Saleor 3.3
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 input

Sort 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.

Requires one of the following permissions: MANAGE_PAGESMANAGE_PAGE_TYPES_AND_ATTRIBUTESMANAGE_PRODUCTSMANAGE_PRODUCT_TYPES_AND_ATTRIBUTES

Attribute.visibleInStorefront ● Boolean! non-null scalar

Whether the attribute should be visible or not in storefront.

Requires one of the following permissions: MANAGE_PAGESMANAGE_PAGE_TYPES_AND_ATTRIBUTESMANAGE_PRODUCTSMANAGE_PRODUCT_TYPES_AND_ATTRIBUTES

Attribute.filterableInStorefront ● Boolean! deprecated non-null scalar

DEPRECATED

This field will be removed in Saleor 4.0.

Whether the attribute can be filtered in storefront.

Requires one of the following permissions: MANAGE_PAGESMANAGE_PAGE_TYPES_AND_ATTRIBUTESMANAGE_PRODUCTSMANAGE_PRODUCT_TYPES_AND_ATTRIBUTES

Attribute.filterableInDashboard ● Boolean! non-null scalar

Whether the attribute can be filtered in dashboard.

Requires one of the following permissions: MANAGE_PAGESMANAGE_PAGE_TYPES_AND_ATTRIBUTESMANAGE_PRODUCTSMANAGE_PRODUCT_TYPES_AND_ATTRIBUTES

Attribute.availableInGrid ● Boolean! deprecated non-null scalar

DEPRECATED

This field will be removed in Saleor 4.0.

Whether the attribute can be displayed in the admin product list.

Requires one of the following permissions: MANAGE_PAGESMANAGE_PAGE_TYPES_AND_ATTRIBUTESMANAGE_PRODUCTSMANAGE_PRODUCT_TYPES_AND_ATTRIBUTES

Attribute.storefrontSearchPosition ● Int! deprecated non-null scalar

DEPRECATED

This field will be removed in Saleor 4.0.

The position of the attribute in the storefront navigation (0 by default).

Requires one of the following permissions: MANAGE_PAGESMANAGE_PAGE_TYPES_AND_ATTRIBUTESMANAGE_PRODUCTSMANAGE_PRODUCT_TYPES_AND_ATTRIBUTES

Attribute.translation ● AttributeTranslation object

Returns translated attribute fields for the given language code.

Attribute.translation.languageCode ● LanguageCodeEnum! non-null enum

A 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

A list of product types that use this attribute as a product attribute.

Attribute.productTypes.before ● String scalar

Return 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

A list of product types that use this attribute as a product variant attribute.

Attribute.productVariantTypes.before ● String scalar

Return 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 ● 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


Was this page helpful?