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!
filterableInDashboard: Boolean!
availableInGrid: Boolean!
storefrontSearchPosition: Int!
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!
}

Fields

id (ID!)

privateMetadata ([MetadataItem!]!)

List of private metadata items. Requires staff permissions to access.

privateMetafield (String)

A single key from private metadata. Requires staff permissions to access.

Tip: Use GraphQL aliases to fetch multiple keys.

Added in Saleor 3.3.

Note: this API is currently in Feature Preview and can be subject to changes at later point.

privateMetafields (Metadata)

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.

Note: this API is currently in Feature Preview and can be subject to changes at later point.

metadata ([MetadataItem!]!)

List of public metadata items. Can be accessed without permissions.

metafield (String)

A single key from public metadata.

Tip: Use GraphQL aliases to fetch multiple keys.

Added in Saleor 3.3.

Note: this API is currently in Feature Preview and can be subject to changes at later point.

metafields (Metadata)

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

Added in Saleor 3.3.

Note: this API is currently in Feature Preview and can be subject to changes at later point.

inputType (AttributeInputTypeEnum)

The input type to use for entering attribute values in the dashboard.

entityType (AttributeEntityTypeEnum)

The entity type which can be used as a reference.

name (String)

Name of an attribute displayed in the interface.

slug (String)

Internal representation of an attribute name.

type (AttributeTypeEnum)

The attribute type.

unit (MeasurementUnitsEnum)

The unit of attribute values.

choices (AttributeValueCountableConnection)

List of attribute's values.

Sort attribute choices.

Filtering options for attribute choices.

Return the elements in the list that come before the specified cursor.

Return the elements in the list that come after the specified cursor.

Return the first n elements from the list.

Return the last n elements from the list.

valueRequired (Boolean!)

Whether the attribute requires values to be passed or not. Requires one of the following permissions: MANAGE_PAGES, MANAGE_PAGE_TYPES_AND_ATTRIBUTES, MANAGE_PRODUCTS, MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.

visibleInStorefront (Boolean!)

Whether the attribute should be visible or not in storefront. Requires one of the following permissions: MANAGE_PAGES, MANAGE_PAGE_TYPES_AND_ATTRIBUTES, MANAGE_PRODUCTS, MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.

filterableInStorefront (Boolean!)

Whether the attribute can be filtered in storefront. Requires one of the following permissions: MANAGE_PAGES, MANAGE_PAGE_TYPES_AND_ATTRIBUTES, MANAGE_PRODUCTS, MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.

filterableInDashboard (Boolean!)

Whether the attribute can be filtered in dashboard. Requires one of the following permissions: MANAGE_PAGES, MANAGE_PAGE_TYPES_AND_ATTRIBUTES, MANAGE_PRODUCTS, MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.

availableInGrid (Boolean!)

Whether the attribute can be displayed in the admin product list. Requires one of the following permissions: MANAGE_PAGES, MANAGE_PAGE_TYPES_AND_ATTRIBUTES, MANAGE_PRODUCTS, MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.

storefrontSearchPosition (Int!)

The position of the attribute in the storefront navigation (0 by default). Requires one of the following permissions: MANAGE_PAGES, MANAGE_PAGE_TYPES_AND_ATTRIBUTES, MANAGE_PRODUCTS, MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES.

translation (AttributeTranslation)

Returns translated attribute fields for the given language code.

A language code to return the translation for attribute.

withChoices (Boolean!)

Flag indicating that attribute has predefined choices.

productTypes (ProductTypeCountableConnection!)

Return the elements in the list that come before the specified cursor.

Return the elements in the list that come after the specified cursor.

Return the first n elements from the list.

Return the last n elements from the list.

productVariantTypes (ProductTypeCountableConnection!)

Return the elements in the list that come before the specified cursor.

Return the elements in the list that come after the specified cursor.

Return the first n elements from the list.

Return the last n elements from the list.

Interfaces

Node

An object with an ID

ObjectWithMetadata