We use discount codes widely for our events, including the use of what I'd call 'admin-only' codes so that we can apply discounts to registrations that we make on behalf of people like speakers, representatives of event sponsors, etc.

Whilst it is helpful to to clearly show in the receipt/confirmation email that the event fee has been discounted, we don't really want the code itself to be included, as this is an internal code and not for wider use.

Is there a way to suppress the inclusion of the code in the receipt, perhaps still allowing the description text for the code to be included?

  • 1
    You can modify the receipt by going to Mailings>Message Templates>System Workflow Messages tab>Events - Registration Confirmation and Receipt (on-line). CiviDiscount seems to modify the string in the 'Fee Level' field itself when the code is applied, which looks like it's just printed as a whole in the template, so someone would need to be quite clever to break out those pieces and achieve what you are asking, I think. Sep 23, 2016 at 19:55
  • Thanks Eli. Do others feel that publishing the discount code itself in this way is a potential security issue?
    – Graham
    Sep 26, 2016 at 7:17
  • 1
    Actually it doesn't make sense at all for the code or the description for the code to be included in the receipt that is sent to the user. By all means it should be recorded as part of the contribution record so that administrators have visibility of the codes that are being used, but I can't see any compelling rationale to include it in the receipt.
    – Graham
    Nov 14, 2016 at 20:21
  • 1
    I agree with you and my gut instinct says it's only in the receipt because of the way civiDiscount modifies the fee level string to record the code use (fee level probably should be in the receipt because usually it denotes the event item or what have you purchased). I'm stuck short of a really great system in a few places with the functionality of civiDiscount (which we rely on quite heavily for complex events), including this piece, but i'm just not there yet in terms of programming (or budget) to take a stab at them, if they are even possible. Nov 14, 2016 at 20:36
  • I've logged it as an issue here: github.com/dlobo/org.civicrm.module.cividiscount/issues/166
    – Graham
    Nov 14, 2016 at 20:39

1 Answer 1


I've edited the message template and used a truncate filter on the $line.label to hide the discount code. Something like this is what I've done:

<td {$tdfirstStyle}>
{* Truncate $line.label to hide a discount code if present for certain event types *}
{if $event.event_type_id == 12}
  {if $line.html_type eq'Text'}
    {$line.field_title} - {$line.label|truncate:7:"":false:false}
  {if $line.html_type eq 'Text'}
    {$line.field_title} - {$line.label}
{if $line.description}

I think for this to work cleanly you might need to have Fee Levels with names of similar character count. There might be some other output filter that would work better than truncate... I recall trying to use some sort of RegEx filter that didn't work.

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.