PDF Template conditionals

I have created a PDF invoice template under ALL > PDF Templates, which contains all the info I need.

What I can’t figure out, is how to use conditionals in these templates. I’ve added all relevant details in the BODY block, but sometimes data is empty and I would like to hide something. I was hoping to do something like the below - if VAT is not empty, then output VAT value, otherwise don’t output anything:

{if $billing_account_intl_vat_number_c !==''}
  VAT no.: $billing_account_intl_vat_number_c
{/if}

Additionally, where I output product info, sometimes I only want to output the product description and not the product name. So if a product name = [BLANK] (which is the product name I don’t want to print), then just output the description, otherwise output both product name and description. Essentially something like:

{if $aos_products_quotes_name =='[BLANK]'}
  $aos_products_quotes_item_description
{/else}
  $aos_products_quotes_name
  $aos_products_quotes_item_description
{/end}

The problem is, if I add this kind of conditional in the HTML block, it just outputs the {if… in cleartext.

Perhaps it’s not possible to add conditionals like this? But how could it be done?

No, I don’t think it’s possible to use Smarty on templates (to my knowledge, it never was).

The way to do this would be to add custom fields for the exact thing that you need to output on the Emails, and prepare them beforehand with logic done elsewhere. This could be a workflow or a logic_hook.