Home Forums Event Espresso Premium Add Event Categories to Description in Stripe Transaction

Add Event Categories to Description in Stripe Transaction

Posted: May 12, 2020 at 6:30 am

Antenna Digital

May 12, 2020 at 6:30 am

I’m using this snippet that I found in the forum for adding a custom field to the Stripe Transaction Description.

I get the event name and the “| category: ” in the transaction as expected….but I can’t figure out how to get the Event Categories at this point in the transaction.
(see this line: $event_cat = WHAT DO I USE HERE TO GET CATEGORIES; below)

'stripe_elements_cf_order_desc', 10, 4
function stripe_elements_cf_order_desc(
) {
if ($transaction instanceof EEI_Transaction) {
$primary_registrant = $transaction->primary_registration();
if ($primary_registrant instanceof EE_Registration) {
$event = $primary_registrant->event_obj();
if ($event instanceof EEI_Event) {
$desc = $event->name();
$desc .= ' | category: ' . $event_cat;
$stripe_data['description'] = $desc;
return $stripe_data;


  • Support Staff

May 12, 2020 at 6:54 am

If you want just a single category (the first EE finds on the event):

$event_cat = '';
$category = $event->first_event_category();
if ($category instanceof EE_Term) {
    $event_cat = $category->name();

If you have multiple categories on the events you can use $event->get_all_event_categories(); which will return an array of EE_Terms for you to loop over.

Antenna Digital

May 13, 2020 at 6:50 am

Thanks Tony, this works great for what we’re after.
On a related note, is there a way to include the Categories in the Registration export? I know I can filter by them and then export the filtered results, but the client would like everything in one sheet with a column for the Categories.
(let me know if this needs to be a new forum post)


  • Support Staff

May 14, 2020 at 5:27 am

We have a snippet in our code snippet library that should do the above for you in:

You can add that to a custom functions plugin on the site and we have some documentation on creating one here:

You must be logged in to reply to this support post. Sign In or Register for an Account

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3 Documentation for Event Espresso 4

Status: publish

Updated by  Tony 2 months, 3 weeks ago ago

Topic Tags


This topic is: not resolved
Do NOT follow this link or you will be banned from the site!