I just can't seem to get any conditional statement to work using Smarty. Essentially, the logic should say, 'if the contribution is Membership Dues, say this. If it's a Donation, say this'.

I'm using other Smarty content in the template and it works fine, but as soon as I add the 'if' statement I get a fatal error.

Here's what I currently have:

{capture assign=contribution_type}{contribution.financial_type_id}{/capture} {if "$contribution_type" == "1"}This is for Membership. {else}This is for Donation. {/if}

Things I've tried:

  • Set CKeditor - Entities =True
  • Every variations of wrapping field and value in "" or '' or nothing.
  • adding {} around the field e.g. {$contribution_type}, with and without single and double quotes.
  • with and without the $

Am I missing something obvious or misunderstanding altogether?

Wordpress: 6.1.1 CiviCRM: 5.55.2

Much thanks in advance for any insight.

1 Answer 1



{capture assign=contribution_type}{contribution.financial_type_id}{/capture} 
{if $contribution_type eq 1}This is for Membership. {else}This is for Donation. {/if}
  • Thanks so much. Just syntax. I thought I had tried all the combinations...
    – shibetpc
    Commented Jan 29, 2023 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.