Skip to main content

Hello!

I am sending an email alerting purchasers that their wine allocation order that they placed last month is shipping, and would like to populate the address on their orders so they can confirm if it has changed prior to shipping. I have create custom fields for the shipping address, but am wondering how I can skip the line if there is no data in “Shipping Company” or “Shipping Address 2”. I am not great at custom html, and these are the fields I have used in the regular body of the email which are populating correctly, but the lines are too spread out if there is no company or address 2. Can someone please help? Thanks!

{{ person|lookup:"Shipping First Name"|default:'' }} {{ person|lookup:"Shipping Last Name"|default:'' }}
{{ person|lookup:"Shipping Company"|default:'' }}
{{ person|lookup:"Shipping Address 1"|default:'' }}
{{ person|lookup:"Shipping Address 2"|default:'' }}
{{ person|lookup:"Shipping City"|default:'' }}, {{ person|lookup:"Shipping State"|default:'' }} {{ person|lookup:"Shipping Zip"|default:'' }}

Hi ​@prowinewoman, welcome to the community!

So you can use a conditional “if” tag to check if a variable has any value, and then display it if it does. You can learn more about conditional syntax in templates here:

But, this code *should* work, but make sure to test:

<p>
{{ person|lookup:"Shipping First Name"|default:'' }} {{ person|lookup:"Shipping Last Name"|default:'' }}<br>

{% if person|lookup:"Shipping Company" %}
{{ person|lookup:"Shipping Company" }}<br>
{% endif %}

{{ person|lookup:"Shipping Address 1"|default:'' }}<br>

{% if person|lookup:"Shipping Address 2" %}
{{ person|lookup:"Shipping Address 2" }}<br>
{% endif %}

{{ person|lookup:"Shipping City"|default:'' }},
{{ person|lookup:"Shipping State"|default:'' }}
{{ person|lookup:"Shipping Zip"|default:'' }}
</p>

Give that a try and let us know if it worked!

 


Hi Joseph,  thank you so much! I was testing something like this out and it is working well! I appreciate your reply.