Describes a Product Attribute and allows you to define meta-information associated with the Attribute (like whether it should be searchable, or its constraints).

interface AttributeDefinition {
    attributeConstraint: string;
    inputHint: string;
    inputTip?: LocalizedString;
    isRequired: boolean;
    isSearchable: boolean;
    label: LocalizedString;
    name: string;
    type: AttributeType;
}

Properties

attributeConstraint: string

Specifies how Attributes are validated across all variants of a Product.

inputHint: string

Provides a visual representation directive for values of this Attribute (only relevant for AttributeTextType and AttributeLocalizableTextType).

inputTip?: LocalizedString

Provides additional Attribute information to aid content managers configure Product details.

isRequired: boolean

If true, the Attribute must have a value on a ProductVariant.

isSearchable: boolean

If true, the Attribute's values are available for the Product Projections Search API for use in full-text search queries, filters, and facets.

Which exact features are available with this flag depends on the specific [AttributeType](ctp:api:type:AttributeType).
The maximum size of a searchable field is **restricted** by the [Field content size limit](/../api/limits#field-content-size).
This constraint is enforced at both [Product creation](/../api/projects/products#create-product) and [Product update](/../api/projects/products#update-product).
If the length of the input exceeds the maximum size, an [InvalidField](ctp:api:type:InvalidFieldError) error is returned.

Human-readable label for the Attribute.

name: string

User-defined name of the Attribute that is unique within the Project.

Describes the Type of the Attribute.

Generated using TypeDoc