Hey @Isabellevandijk
I think the problem with the original code is slice:":1". It only reads the first line item Shopify sends over, and Shopify doesn't guarantee any particular order. So if someone buys both a large and a small, you're basically rolling the dice on which one shows.
The fix is to scan all line items first, set flags, then render based on priority.
{% with event.extra.line_items as items %}
{% assign has_large = false %}
{% assign has_medium = false %}
{% assign has_small = false %}
{% for item in items %}
{% if '78 cm' in item.name or 'Large' in item.name %}
{% assign has_large = true %}
{% elsif '67 cm' in item.name or 'Medium' in item.name %}
{% assign has_medium = true %}
{% elsif '55 cm' in item.name or 'Small' in item.name %}
{% assign has_small = true %}
{% endif %}
{% endfor %}
{% if has_large %}
YOUR LARGE CONTENT BLOCK HERE
{% elsif has_medium %}
YOUR MEDIUM CONTENT BLOCK HERE
{% elsif has_small %}
YOUR SMALL CONTENT BLOCK HERE
{% endif %}
{% endwith %}
Two passes. First loop reads every line item and flips the right flag to true. Second block checks them top-down, large wins, always. Once a bigger size is found, everything below it gets ignored.
Just swap in your actual product names where I've used '78 cm' and 'Large'. If you only have two sizes, delete the medium block entirely.
One thing worth checking: make sure you're pulling item.name and not item.title or item.variant_title. Depending on how your Shopify products are set up, the size text might live in a different field. If the conditions aren't matching, that's usually why. Let me know if this works.
I hope this helps and thank you for sharing your question here in the community.
Cheers
Arpit