Order notification template: conditional code for NOTE

New Member
1 0 0

In our order notification email, I need to display the heading "NOTE" when a customer has included a note...and not display it if they haven't included a note.

I've got a little piece of code in the template that has accomplished this perfectly for the last couple years, but all of a sudden as of yesterday it has stopped working. Now it just shows "NOTE" on every order.

Does anyone know what has changed and/or how we can fix this?

Please see my code below.

Thanks!

----------------------------------------------------------------------------------------------

Order Number: 10{{ order_number }}<br>
Date Ordered: {{ date | date: "%A, %B %-d, %Y" }}<br>
Order Details<br>
------------------------------------------------------<br>
{% for line in line_items %}{{ line.quantity }} x {{ line.sku }}  = {{ line.line_price | money }}<br>
{% endfor %}------------------------------------------------------<br>
<br>
{% if note != '' %}<br>
NOTE: {{ note }}<br>
{% endif %}<br>
<br>
SHIP TO:<br>
------------------------------------------------------<br>
{{ email }}<br>
<br>
{{ shipping_address.name }}<br>
{{ shipping_address.street }}<br>
{{ shipping_address.city }}, {{ shipping_address.province }}  {{ shipping_address.zip }}<br>
{{ shipping_address.country }}<br>
{{ shipping_address.phone }}<br>
------------------------------------------------------<br>
<br>
{% if discounts %}Coupon: {{ discounts.first.code }}: {{ discounts_savings | money }}{% endif %}<br>
Subtotal: {{ subtotal_price | money }}<br>
{% for tax_line in tax_lines %}Tax: {{ tax_line.price | money  }}{% endfor %}<br>
Shipping ({{ item_count }} pc.): {{ shipping_price | money }}<br>
<br>
Total: {{ total_price | money_with_currency }}<br>
{% assign gift_card_applied = false %}{% assign gift_card_amount = 0 %}{% for transaction in transactions %}{% if transaction.gateway  == 'gift_card' %}{% assign gift_card_applied = true %}{% assign gift_card_amount = gift_card_amount | plus: transaction.amount %}{% endif %}{% endfor %}{% if gift_card_amount > 0 %}<br>
Gift card redeemed: {{ gift_card_amount | times: -1 | money }}{% endif %}<br>
<br>
<br>
<br>
Billing address:<br>
------------------------------------------------------<br>
{{ billing_address.name }}<br>
{{ billing_address.street }}<br>
{{ billing_address.city }}, {{ billing_address.province }}  {{ billing_address.zip }}<br>
{{ billing_address.country }}<br>
{{ billing_address.phone }}<br>
------------------------------------------------------<br>
<br>
<br>
<br>
 

0 Likes
Shopify Expert
2663 63 663

Hi Ben, 

probably, some update to liquid made it more strict while doing comparisons?

I'd try to change the condition in this code of yours. 

{% if note != '' %}<br>
NOTE: {{ note }}<br>
{% endif %}<br>

Instead of note != '' I'd try simply note or, maybe note.empty? (the questionmark is a part of the property name here).

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
0 Likes
New Member
4 0 0

I also need a solution for this. I've used this code below to no avail.

 

{% if note %}
"{{ note }}"
{% endif %}
0 Likes