Home > OS >  Simple IF statement only returning code in ELSE
Simple IF statement only returning code in ELSE

Time:10-06

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

CodePudding user response:

You need to check the if elsif else enter image description here

CodePudding user response:

Onkar - this is the image of the metafield from the order section This is the metafield information

  • Related