Product.template.liquid embed image based on logic

I’m using product type and tags to show relevant shipping images on my product pages.

My concern is that filtering logic using product.type or tags does not seem to be working.

I’m seeing the image on products that don’t have ‘freeshipping’ tag and the product.price > 225 definitely isn’t triggering.

The logic seems straight forward but this product has no freeshipping tag and yet still shows an image

https://electroarcade.com.au/collections/arcade-machines/products/split-console-mix-and-match-cover-artwork-upgrade

I added an extra {% else %} at the end just in case but no luck.

{% if product.type == ‘retro arcade games console’ and product.tags contains ‘freeshipping’ and product.price > 225 %}

{% else if product.type == ‘retro arcade games console’ and product.tags contains ‘freeshipping’ %}

{% else %}
{% endif %}

Would appreciate your input as to where I’ve gone wrong here.

Thanks

Can you first fix your else if line?

It is not:

else if

but rather

elsif

See reference:
https://shopify.dev/docs/themes/liquid/reference/tags/control-flow-tags

Thanks Jason,

Read through that a few times but seems I somehow mixed up the else and elseif.

That’s stopped it showing on some products :slightly_smiling_face:

The logic is still failing as showing the first image even if I move price upto 260 which should trigger the elsif here https://electroarcade.com.au/collections/arcade-machines/products/split-retro-arcade-leading-game-consoles-12s-h3

{% if product.type == ‘retro arcade games console’ and product.tags contains ‘freeshipping’ and product.price > 260 %}

{% elsif product.type == ‘retro arcade games console’ and product.tags contains ‘freeshipping’ %}

{% else %}
{% endif %}

more tweaking and sorted it all out.

:slightly_smiling_face:

Glad you got it sorted. That elsif is an easy trap to fall into. I’ve done it plenty of times. You’d think i’d have it down after all these years but still the brain sometimes defaults to “else if”.