Problems with Liquid in Order Confirmation Emails

Solved
Highlighted
Tourist
8 1 1

Hi there!

I am trying desperately to set up Liquid logic so that my order confirmation emails reflect different messages depending on the shipping method chosen. I offer local pickup, local delivery, and free shipping. I've tried multiple iterations to try to get it right, but no matter what I do I can't seem to get the logic to work properly for all 3 messages. This is the closest I've come so far:

 

Thank you for your order!

{% if order.pickup_in_store? %}

PICKUP MESSAGE

{% elsif checkout.shipping_method.title == ‘Local Delivery‘%}

DELIVERY MESSAGE

{% elsif checkout.shipping_method.title == ‘Free Shipping‘%} 

SHIPPING MESSAGE

{% endif %}

 

This works properly for Local Pickup and Local Delivery, but for Free Shipping it gives me the message for Local Delivery rather than Free Shipping. I know the problem is with the final elsif, because when I switch the line for Local Delivery and Free Shipping then I just get the message for Free Shipping and not Local Delivery. I've tried using {% else %} instead of elsif for the final message but that doesn't seem to work either. 

Any help would be greatly appreciated!

0 Likes
Shopify Partner
1079 169 194

Hi There!

Would need a clearer picture here on your shipping methods to be able to write a better analysis here.

- Did we solve your issue? Like & Mark As Solution to help the community
- Should you need any direct help: contact@jhkcreate.com
K&J
0 Likes
Highlighted
Tourist
8 1 1

Hmm... I'm not quite sure I know what you mean. Both Local Delivery and Local Pickup are Shopify's own options under the shipping and delivery settings. Free Shipping is a custom domestic shipping rate I created under General Shipping. Does that help?

0 Likes
Highlighted
Tourist
8 1 1

This is an accepted solution.

Finally found a solution! If anyone else ever has this issue, I did mine like this:

 

Thank you for your order!
{% if requires_shipping %}
{% if shipping_method.title == 'Free Shipping'%}
Free Shipping Message
{% elsif shipping_method.title == 'Local Delivery' %}
Local Delivery Message
{% endif %}
{% if order.pickup_in_store? %}
Local Pickup Message
{% endif %}
{% endif %}

0 Likes