S123C22
S123C22

Reputation: 11

Liquid 'If Contains'

I am fairly new to the coding language and what I am trying todo is probably fairly difficult but I would like to attempt it if I can.

I have dispatch notes which I would like to display an image if it is express delivery, so it is easily noticeable. The dispatch notes are in html/ liquid. This is where I have got to so far but it doesn't seem to work

{{% if contains_Standard UK %}} {{ 'express.png'> | | img_tag }}

it is for the information that comes from this {{ order.shipping_lines[0].title }}

Upvotes: 1

Views: 1163

Answers (1)

Alice Girard
Alice Girard

Reputation: 2173

First, double {{ is for displaying something. To execute something, you must start with {%.

Then, as any language, when you want to check a condition, it is necessry to compare two values.

Here, you should have something like:

{% if order.shipping_lines[0].title contains 'Standard UK' %} Do something {% endif %}

HTH

Upvotes: 2

Related Questions