Put conditional in email subject

Uni-Trend
Excursionist
23 0 22

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
36 7 6

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

A creative code agency