How to create dynamic attribute
Dynamic attributes allow you to set attribute values based on conditions or other attribute values.
Create a new dynamic attribute
1. Navigate to the Dynamic attributes section
- Go to Catalog -> Advanced Product Feeds -> Dynamic attributes.
- Click Add attribute.
2. Configure the Dynamic attribute
2.1 Basic information
- Enter a name for the dynamic attribute in the Name field.
- Set a unique identifier (used in templates) in the Code field.
2.2 Set conditions
- Click Add "OR" condition if any condition is met, the attribute applies.
- Click Add "AND" Condition all conditions must be met for the attribute to apply.
- Choose the attribute to evaluate in the Select Attribute field.
- Define the rule (e.g., "greater than," "contains," etc.) in the Select condition.
- Specify the value that triggers the condition in Enter value field.
2.3 Set output
-
Select output type to choose how the attribute is returned.
-
Define output either select an existing attribute or enter a custom value.
NoteIf no conditions are set, the dynamic attribute will return a default value.
3. Save the attribute
- Click Save to store the new dynamic attribute.
Example for dynamic attribute
Additional stock status
Configuration
- Name: Additional stock status
- Code:
stock_status
- Condition: if stock quantity is greater than 0, return "In Stock"; otherwise, return "Out of Stock".
Usage in feeds
- XML template:
{{ product.dynamic:stock_status }}
- CSV template: select the dynamic attribute from the dropdown.