0

I am setting up an email for refund confirmations. I have this ampscript set up:

%%[
var  @payment_method, @paymentblock, 
set @payment_method = payment_method
]%%

Later on I have:

IF @payment_method == 'CreditCard' 
THEN SET @paymentblock = '<strong>%%cc_company%%</strong> account (account number ending in %%card_lastfour%%)'

Instead of displaying the values of %%cc_company%% and %%card_lastfour%%, the email displays the text '%%cc_company%%' and '%%card_lastfour%%'.

1 Answer 1

3

That’s because you put it in '' which makes it a string, and it’s literally displaying what’s in that string. Try using the Concat() function instead. I’d also set all variables properly using the AttributeValue() function:

set @payment_method = AttributeValue('payment_method')
set @cc_company =  AttributeValue('cc_company')
set @card_lastfour = AttributeValue('card_lastfour')

SET @paymentblock = concat('<strong>',@cc_company,'</strong> account (account number ending in ',@card_lastfour,')')
1
  • 1
    You can also just output using the TreatAsContent() function when you want to display instead of v() and it should fill in the personalization strings, etc. as well since it processes it instead of displaying as string. For cleaner code, I would recommend @zuzannamj method though. Commented Dec 9, 2022 at 16:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .