I am trying to create a simple IF statement to return a string of text in the email template that goes out to a customer when the order is fulfilled in Shopify.
I’m using this:
{% if order.metafields.custom.delivery_vehicle_type == 'Third-party Courier' %}
TEXT for courier
{% elsif order.metafields.custom.delivery_vehicle_type == 'Rigid Crane' %}
TEXT for RIGID CRANE
{% elsif order.metafields.custom.delivery_vehicle_type == 'Articulated Lorry (w/forklift)' %}
TEXT for MOFFET
{% else order.metafields.custom.delivery_vehicle_type == 'Articulated Lorry (w/Crane)' %}
TEXT for ARTIC CRANE
{% endif %}
But regardless of how I do this code, it only ever returns the ELSE section.
I have another code to check that the "custom.delivery_vehicle_type" does contain the correct information when selected in the metafield.
What am I doing wrong?
Any help will be great!!
TVM
D
2
Answers
Onkar - this is the image of the metafield from the order section
You need to check the
if
elsif
else
hereyou can pass the condition to
else
directly you need useelsif
and you code become:and lastly use
{{vehical_type }}
like this where you want in bellow code.