We've got CiviDiscount working to apply the appropriate discounts for memberships and events, but would like to be able to add all contacts that have used a discount to a report (for our sponsors) or smart group. When I go to the CiviDiscount page, I can see the list of contacts who've redeemed each code, but would like to be able to search and act on that information. So I guess my question is how can I add a Custom search for codes redeemed?

  • I note this question is a few years old, but I am facing the same problem and wondering if there have been any changes in CiviDiscount that would help, In our case we would like to offer a fixed discount for membership when one elects to go paperless with our publications. We would need a Smart Group that excludes those who have taken the discount to send to the mailing house. I take it from the replies so far that this is not easily done. Anything changed since then? (One can hope.) Commented Aug 12, 2021 at 11:24
  • 1
    Not that I know of - the extended reports was enough for our use (we could search for any code and then add it to a group) so we didn't keep going. We're on Drupal with Webforms, so have moved to using that to replace a lot of our contributions and membership forms.
    – kathc
    Commented Aug 13, 2021 at 12:44

3 Answers 3


We have made a participants view in Drupal that shows all event participants who have redeemed a code. We can then add them to a group for use in further searches in Civi.

I don't know how you would do this with a smart group, but at least this might get you part of the way.

We'll be doing a similar thing for memberships in due course, if that's possible.

To do this you need: Drupal, Civicrm entity (ours is beta9), and turn on the sub module: civicrm_entity_actions as Pete mentions in the comments to the first answer here: How to configure Views VBO action to disable relationships? You also need Views Bulk Operations

The participant view needs to have this relationship: CiviCRM Contributions: Contact Record ID

The view also needs to have an exposed filter of the Participants fee level field. (NB, don't confuse this with the Events Fee level or the Contribution Amount label fields. They won't produce the same results).

Then you can filter your view by keywords from your codes.

Add the field, (CiviCRM Contact, with custom fields) Bulk operations: CiviCRM Contact. Note this will need a relationship to Civicrm Contact. Initially it won't give you the option to add a group, but after saving the field and then re-editing it you will see Add contact to group as an option.

You will have had to previously made a suitable group in Civi.

Et Voila! Now you can bulk add participants who've used your code to your group.

I can send you an export of the view if that's helpful. Good luck!

NB: it might be helpful to know that the Contributions: Amount label field will work fine for this purpose for online event bookings. But bookings taken through the admin interface may not contain the discount code in the Amount label field.


Karin Gerritsen has created an update to the Extended Reports module to allow any discount codes to be exposed in a report, with various actions that can then be run on the search result, which is exactly what I wanted. Previously the Extended reports only worked on discount codes for events, not for memberships. Can ExtendedReports report on CiviDiscount usage?


Andy's solution is related to what you ask, and Eli Lisseck's CiviDiscount report is too - but none of these will give you a custom search, which you need for a smart group.

There's documentation on creating custom searches here. I think that if you write this extension, it'd be great to submit an answer to this question with a link to the Github!

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.