Skip to main content

Attribute Object

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
referenceTypes(
limit: PositiveInt = 100
): [ReferenceType!]
name: String!
slug: String!
type: AttributeTypeEnum!
unit: MeasurementUnitsEnum
choices(
sortBy: AttributeChoicesSortingInput
filter: AttributeValueFilterInput
where: AttributeValueWhereInput
search: String
before: String
after: String
first: Int
last: Int
): AttributeValueCountableConnection
valueRequired: Boolean!
visibleInStorefront: Boolean!
filterableInStorefront: Boolean! @deprecated
filterableInDashboard: Boolean! @deprecated
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

id ● ID!

The ID of the attribute.

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.

key ● String!

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.

keys ● [String!]

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.

key ● String!

metafields ● Metadata

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

keys ● [String!]

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.

referenceTypes ● [ReferenceType!]

The reference types (product or page type) that are used to narrow down the choices of reference objects.

Added in Saleor 3.22
limit ● PositiveInt

Maximum number of objects to return. Value must be greater than 0. Default is 100.

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

A list of predefined attribute choices available for selection. Available only for attributes with predefined choices.

sortBy ● AttributeChoicesSortingInput

Sort attribute choices.

filter ● AttributeValueFilterInput
DEPRECATED

Use where filter instead.

Filtering options for attribute choices.

where ● AttributeValueWhereInput

Where filtering options for attribute choices.

Added in Saleor 3.22

Search attribute choices.

Added in Saleor 3.22
before ● String

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

after ● String

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

first ● Int

Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.

last ● Int

Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.

valueRequired ● Boolean!

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

visibleInStorefront ● Boolean!

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

translation ● AttributeTranslation

Returns translated attribute fields for the given language code.

languageCode ● LanguageCodeEnum!

A language code to return the translation for attribute.

withChoices ● Boolean!

Flag indicating that attribute has predefined choices.

productTypes ● ProductTypeCountableConnection!

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

before ● String

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

after ● String

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

first ● Int

Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.

last ● Int

Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.

productVariantTypes ● ProductTypeCountableConnection!

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

before ● String

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

after ● String

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

first ● Int

Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.

last ● Int

Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.

externalReference ● String

External ID of this attribute.

Show deprecatedHide deprecated

filterableInStorefront ● Boolean!

DEPRECATED

This flag is not used by Saleor. Keep the logic in the storefront or use Attribute metadata instead.

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

filterableInDashboard ● Boolean!

DEPRECATED

This flag is not used by Saleor. Keep the logic in the dashboard or use Attribute metadata instead.

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

availableInGrid ● Boolean!

DEPRECATED

This flag is not used by Saleor. Keep the logic in the storefront or use Attribute metadata instead.

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

storefrontSearchPosition ● Int!

DEPRECATED

This flag is not used by Saleor. Keep the logic in the storefront or use Attribute metadata instead.

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

Interfaces

Node

An object with an ID

ObjectWithMetadata

Returned By

attribute query

Member Of

AssignedAttribute interface ● AssignedBooleanAttribute object ● AssignedDateAttribute object ● AssignedDateTimeAttribute object ● AssignedFileAttribute object ● AssignedMultiCategoryReferenceAttribute object ● AssignedMultiChoiceAttribute object ● AssignedMultiCollectionReferenceAttribute object ● AssignedMultiPageReferenceAttribute object ● AssignedMultiProductReferenceAttribute object ● AssignedMultiProductVariantReferenceAttribute object ● AssignedNumericAttribute object ● AssignedPlainTextAttribute object ● AssignedSingleCategoryReferenceAttribute object ● AssignedSingleChoiceAttribute object ● AssignedSingleCollectionReferenceAttribute object ● AssignedSinglePageReferenceAttribute object ● AssignedSingleProductReferenceAttribute object ● AssignedSingleProductVariantReferenceAttribute object ● AssignedSwatchAttribute object ● AssignedTextAttribute object ● 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 ● CustomerType object ● PageType object ● ProductType object ● SelectedAttribute object