{% if products|length == 4 %}
    {% set columns = "col-6 col-md-3" %}
{% endif %}
{% if products|length == 3 %}
    {% set columns = "col-4" %}
{% endif %}
{% if products|length == 1 %}
    {% set columns = "col" %}
{% endif %}

<div class="row">
    {% for product in products %}
        <div class="{{ columns|default('') }} d-flex">
            {% include '@SyliusShop/Product/_box.html.twig' %}
        </div>
    {% endfor %}
</div>
