What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Put conditional in email subject

Put conditional in email subject

Uni-Trend
Excursionist
33 0 28

Hi,

 

Is there any way to put a conditional call a for metafield into an email subject line? 

 

For instance, if a customer paid with a PO number, I would want to make the subject:

{%- if order.metafields.custom.customer_po !=blank %} A shipment from your {{ order.metafields.custom.customer_po }} is on the way {% else %} A shipment from order {{ name }} is on the way  {% endif %}

So, if there's something in the field, it would show one subject message, if it's blank, it show the standard message. 

 

Thanks,


Pete

Reply 1 (1)

BlackCro
Shopify Partner
101 19 16

Hi Pete, 

 

Have you tried this using the edit email templates and it didn't work? If so try removing the order. from the declarations as this isn't required.

 

There is more info available at the documentation link below. 

 

https://help.shopify.com/en/manual/orders/notifications/email-variables

 

Hope this helps

Simon

BlackCro.co.uk

CRO & Development Agency



Better Forms - Get a better contact form today!