Skip to content

Attributes

Attributes allow data models to be enriched with additional data without changing the database schema.

This includes products, categories, customers, addresses, carts, cart items, orders and more.

Attributes can be of different data types and have various input types. Each attribute is bound to a single entity. This means each entity, like product or category, has its own set of attributes defined.

The attributes are grouped into attribute sets and each data model entry can have a different attribute set assigned to it. A single attribute can be assigned to one or more attribute sets.

Using the assigned attribute set, it is determined which attribute values a particular data model entry can hold and which values can be edited by a frontend store customer and the back office user. This means if an attribute is deleted and the data model entry using it is re-saved, the attribute's value will also be removed.

Attributes allow scoped values by default, unless they're explicitly flagged to store only global values (default scope).

Additionally, flags can be set on an individual attribute which define their behavior on the store frontend and the back office.

Create an attribute


Navigate to AttributesAttributes and click on "Add attribute". Select an entity to add an attribute to.

Edit attribute

Enter a unique code for the attribute. Uniqueness is enforced per entity which means no entity can have two attributes with the same code.

Select a compatible data type and input type:

Data type Input types
bool boolean
date date
datetime datetime
string text, number, email, textarea, file, file_multiple
text text, number, email, textarea, file, file_multiple
decimal text, number, range
price text, number, range
int text, number, range
json textarea
options select, multiselect

Add the attribute to one or many attribute sets.

Optionally, assign flags to the attribute and set a position value. Position is used for sorting a list of attributes when shown in a back office grid or in the product filter list of a category view in the frontend store.

Flag legend:

Value Description
comparable Attribute can be used for comparing products in the store frontend.
editable Allow editing (currently unused).
factory Factory attribute. Removal of such attribute won't be allowed in the back office.
filterable Allow filtering on the store frontend, for example products in category view.
filterable_in_grid Allow filtering in a back office grid.
global Disallow scoped values. Attribute's value will only be stored in default scope.
presentable Should be presented in store frontend, for example in product view/details page (PDP).
required Value of the attribute cannot be empty.
searchable Use the attribute in store frontend search, for example when doing full-text product search.
sortable Allow the attribute to be used for sorting in store frontend, for example in category view.
searchable_in_grid Use the attribute in back office grid full-text search (currently unused).
translatable Allow the attribute to be translated programmatically.
used_in_cart_item Add the attribute to a product entity associated to a cart item in the store frontend cart API endpoint responses.
used_in_grid Show attribute in back office grid.
user_editable Allow editing of the attribute on the store frontend.
visible Expose the attribute in the API; return it in API responses.
visible_in_navigation Expose the attribute in the navigation API; return it in API responses.

Finally, add labels. Only the default label is mandatory.

Click on "Save attribute" to complete the process.

Warning

Once created, the attribute's code and data type are not allowed to be changed. You must delete the attribute and create a new one instead.

Edit attribute options


If an attribute's data type is "options", it means it holds a set of predefined values in the form of key-value. The key in this case is the value and value is the label that is shown in the input, which can be a select or multiselect element.

This data type can have one of two types of source data. Options stored in the database or provided by a source model from the application code. The former can be edited.

Edit attribute options

New options can be added by providing option labels for each scope. Adding the default scope label is mandatory.

Existing options can be filtered, sorted and updated and each one can have a position assigned to it. The position is used for sorting while loading the options from the database, in ascending order.