Definition of a rule
A rule is a set of actions and conditions that allows you to automatize data enrichment. For instance, rules allow you to automatically:
- fill in attributes
- categorize new products
- set a default value to an empty attribute
- assign values to new products
- copy an attribute value to another attribute
A rule is defined by a code (required) and you can name it with a label as well. This label can have a value per locale.
Rules can only be created and imported in Akeneo using a YML file, but you can manage them from the UI. Check our How to manage your rules article.
Rules can be prioritized: a rule with a priority of 100 will be applied before a rule having a priority of 10 or 50.
Example of a rule
You need one or several conditions to trigger an action. For instance, to set the Canon brand to all Canon camcorders that do not have a brand yet, you'll have to create a rule like the one below:
IF:
- my product is in the Camcorders family
- my product attribute name contains the word: Canon
- my brand attribute is empty
THEN: set the Canon value in my product brand attribute
Here is the example of the YML format expected for this rule.
rules:
camera_set_canon_brand:
priority: 0
conditions:
- field: family
operator: IN
value:
- camcorders
- field: name
operator: CONTAINS
value: Canon
- field: camera_brand
operator: 'NOT IN'
value:
- canon_brand
actions:
- type: set
field: camera_brand
value: canon_brand
Find more information about all the conditions/actions and create your own rules! To do so, refer to our technical documentation: General information about rule format.