How to find selected variation value as variable?

Viewed 37

we´re using Shopware 6 and want to display the selected variation value after the title of the variation.

Example:

Variationname: Color Variationvalue: Blue, Green, Black

If we select "Black" we want to display: "Color: Black". Whats the variable for our template?

1 Answers

I found the solution:

{% for option in group.options %}
 {% set isActive = false %}
 {% set isCombinableCls = 'is-combinable' %}
 {% if option.id in page.product.optionIds %}
 {% set isActive = true %}
 {% endif %}
 {% if isActive %}
 {{ option.translated.name }}
 {% endif %}
{% endfor %}
Related