Solved

Problems with Liquid in Order Confirmation Emails

dakineskava
Tourist
8 1 2

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!

Accepted Solution (1)
dakineskava
Tourist
8 1 2

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 %}

View solution in original post

Replies 4 (4)

JHKCreate
Shopify Expert
3571 639 916

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

Learn more about us: jhkcreate.com
dakineskava
Tourist
8 1 2

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?

dakineskava
Tourist
8 1 2

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 %}

Adrian_Cawley
Visitor
2 0 0

Hi , 

 

I am also having issues with mine recently. Had it working for years . And even with the new addition from shopify with local pickup it will not fulfill an order from 2 locations . So I can't use there new feature. 

This was my last working bit of code . My shipping rate name is setup identical to Westport Click & Collect

{% if shipping_method.title == 'Westport Click & Collect' %}
<p>{% if fulfillment.item_count == item_count %}All{% elsif fulfillment_status == 'fulfilled' %}The last{% else %}Some{% endif %} of the items from order {{ name }} are ready for collection:</p>
<p>{% for line in fulfillment.fulfillment_line_items %}<img src="{{ line.line_item | img_url: 'small' }}" />{{ line.quantity }}x {{ line.line_item.title }}<br>
{% endfor %}</p>
<p>{% if requires_shipping %}The order can be collected from the following address: </p>
<p>
For Footwear: <br /> <br />

 

Any help would be appreciate.