# What is a Definition

The idea behind definitions is to enable saving additional information, tailored to your specific needs, for each entity.

Consider the following scenario: You sell shirts and shoes in the store. To do that you need information about sizes and colors on your products.

The solution is simple - Ucommerce supports definitions, to which new fields can be added to store the information you need. You might already be familiar with the concept of *Document Types* in Umbraco or *Templates* in Sitecore. A definition in Ucommerce is basically the same thing but for e-commerce.

## Definition Fields <a href="#definition-fields" id="definition-fields"></a>

Definitions have a list of fields, which are available to the store manager to maintain in the back office. For the S*hirt* definition, you can have two fields available: *Color* and *Size*. For the S*hoe* definition, you can have one field available: *Size.*

Each field has a number of configuration options, which influence the look and functionality in the back office UI. They will be covered in detail in the next sections.

### Multilingual Fields <a href="#multilingual-fields" id="multilingual-fields"></a>

If you need to maintain the data of the field in multiple languages, you can mark the field as being multilingual. This will allow you to define a value per language configured.

### Display on Site <a href="#display-on-website" id="display-on-website"></a>

A `true`/`false` value which is set on the field to indicate whether to display the field on the website. If set to `false`, the field will not be part of the search index.

### Render in Editor <a href="#render-in-editor" id="render-in-editor"></a>

Sometimes you need data you don’t want the back office user to edit. Setting this property to `false` will exclude the field from the back office UI, effectively making the field accessible via code only.

### Data Type <a href="#data-types" id="data-types"></a>

Each field has an associated data type, which determines the editor for the particular field, e.g. a checkbox, text box, date picker, etc. Ucommerce comes with a number of built-in data types such as `ShortText`, `LongText`, `Number`, `Boolean`, `Enum`, and `Image`. \
`Enum` is a special type that enables you to predefine a list of values for the back office user to select from, e.g. colors or sizes. Basically data with a finite number of options to choose from.

#### Validation Expression <a href="#validation-expressions" id="validation-expressions"></a>

A data type can have a validation expression associated with it to validate user input when editing in the back office. A validation expression is a standard regular expression evaluated whenever a field of the given type is saved.

### Converting (string) field values to numbers

Given the flexible nature of the definition system, field values are always stored as strings. When a definition field is of type `Number`  you can use the extension methods `ToDecimal()`, `ToFloat()`, and `ToDouble()` built into Ucommerce, to make sure the value is converted using the same culture Ucommerce uses when storing the value as a string. The extension methods are found in the namespace `Ucommerce.Web.Common.Extensions` .

### Variant property (products only) <a href="#variant-property" id="variant-property"></a>

When creating a definition field on a product, you can decide whether it is a variant field, or not. This will change the definition field from appearing on the parent product, or on the product variant.

## Composable Definitions <a href="#inherited-definitions" id="inherited-definitions"></a>

A definition can inherit from other definitions, which enables you to build your definitions in a composable way. Add fields that are common across multiple definitions, in a single definition and reuse it as a parent for other definitions, e.g. SEO information is something you want to store on all products and categories regardless of their various definitions so the *shirts*, *shoes*, and *accessories* definitions all inherit from the *SEO* definition.

The result is less work when defining new fields as shared fields can be added once and "mixed" in with the relevant definitions.

Ucommerce supports inheritance from multiple parents, which means a single definition may inherit from multiple other definitions, e.g. the *Shoe* definition might inherit fields from both the *SEO* and *Footwear* definition.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev.ucommerce.net/readme/definitions/what-is-a-definition.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
