Snippets

Martin Adams Get cheapest items by size

Created by Martin Adams
    <div class="debug">
        <ul>
            {% for size in item.variations.selections|findByKey('size').options %}
                <li>{{ size.label }} ({{ size.dimensions|dimensionify('/') }})<br>
                    <strong>Chepest: </strong>{{ item.variations.items|filterBySelectionOption('size', size.key)|sortByPrice(true)[0].price|currency|raw }}<br>
                    <strong>Most expensive: </strong>{{ item.variations.items|filterBySelectionOption('size', size.key)|sortByPrice(false)[0].price|currency|raw }}
                </li>
            {% endfor %}
        </ul>
    </div>

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.