I've used HubL properties several times in my emails.
Everytime there is a property and I need to do conditional, I just use,
{% if variable_name %}show your content{% endif %}
I use it the above way when I am using Custom Modules for my Email.
If I want to use normal HubL variables,
For Rich Text,
{% rich_text "my_module" label='My rich text module', html='Default module text' %}
{% if "my_module" %}
A module named "my_module" is defined in this template.
{% endif %}
For text fields,
{% text "product_names" label='Enter the product names that you would like to render the coupon ad for', value='all of our products', export_to_template_context=True %}
{% if widget_data.product_names.value %}
<div class="coupon-ad">
<h3>For a limited time, get 50% off {{ widget_data.product_names.value}}! </h3>
</div>
{% endif %}
For choice fields,
{% choice "department" label='Choose department', value='Marketing', choices='Marketing, Sales, Dev, Services' export_to_template_context=True %}
{% if widget_data.department.value == 'Marketing' %}
<h3>Want to join our amazing Marketing team?!</h3>
<h4>We have exciting career opportunities on the {{ widget_data.department.value }} team.</h4>
{% elif widget_data.department.value == 'Sales' %}
<h3>Are you a Sales superstar?</h3>
<h4>We have exciting career opportunities on the {{ widget_data.department.value }} team.</h4>
{% elif widget_data.department.value == 'Dev' %}
<h3>Do you love to ship code?</h3>
<h4>We have exciting career opportunities on the {{ widget_data.department.value }} team.</h4>
{% else %}
<h3>Want to work with our awesome customers?</h3>
<h4>We have exciting career opportunities on the {{ widget_data.department.value }} team.</h4>
{% endif %}
For Checkbox / Boolean,
{% boolean "check_box" label='Show alert', value=True, export_to_template_context=True %}
{% if widget_data.check_box.value is truthy %}
<div class='alert'>Danger!</div>
{% endif %}
I have the same issue, did you ever resolve this? The accepted answer does not seem relevant to the issues we are facing with transactional emails using the single send API.
I've used HubL properties several times in my emails.
Everytime there is a property and I need to do conditional, I just use,
{% if variable_name %}show your content{% endif %}
I use it the above way when I am using Custom Modules for my Email.
If I want to use normal HubL variables,
For Rich Text,
{% rich_text "my_module" label='My rich text module', html='Default module text' %}
{% if "my_module" %}
A module named "my_module" is defined in this template.
{% endif %}
For text fields,
{% text "product_names" label='Enter the product names that you would like to render the coupon ad for', value='all of our products', export_to_template_context=True %}
{% if widget_data.product_names.value %}
<div class="coupon-ad">
<h3>For a limited time, get 50% off {{ widget_data.product_names.value}}! </h3>
</div>
{% endif %}
For choice fields,
{% choice "department" label='Choose department', value='Marketing', choices='Marketing, Sales, Dev, Services' export_to_template_context=True %}
{% if widget_data.department.value == 'Marketing' %}
<h3>Want to join our amazing Marketing team?!</h3>
<h4>We have exciting career opportunities on the {{ widget_data.department.value }} team.</h4>
{% elif widget_data.department.value == 'Sales' %}
<h3>Are you a Sales superstar?</h3>
<h4>We have exciting career opportunities on the {{ widget_data.department.value }} team.</h4>
{% elif widget_data.department.value == 'Dev' %}
<h3>Do you love to ship code?</h3>
<h4>We have exciting career opportunities on the {{ widget_data.department.value }} team.</h4>
{% else %}
<h3>Want to work with our awesome customers?</h3>
<h4>We have exciting career opportunities on the {{ widget_data.department.value }} team.</h4>
{% endif %}
For Checkbox / Boolean,
{% boolean "check_box" label='Show alert', value=True, export_to_template_context=True %}
{% if widget_data.check_box.value is truthy %}
<div class='alert'>Danger!</div>
{% endif %}