Home Forums Event Espresso Premium Parse event category or other parameters to Mailchimp

Parse event category or other parameters to Mailchimp

Posted: January 15, 2020 at 6:58 pm


January 15, 2020 at 6:58 pm

I’ve set up the Mailchimp integration by following some of the tutorials from the forum to parse the date of the event to my Mailchimp list into an EVENTDATE merge tag.
In addition to that, I would like to know what event they are attending based on the event category, for example, so that I can send them details specific to their event.
I sell different types of classes, so I will have different classes happen at different dates. I would like to set up a sophisticated automated system of emails: send an email to people who signed up to a certain class with the information on how to prepare for the class, then send a reminder 2 days before the event with the details specific to the event, then send an email the day after the event ended (some events are 2-day classes).

What is possible with the Mailchimp addon and what information can I pass to Mailchimp automatically?


January 17, 2020 at 8:38 am

So I looked up some code that allows to parse the event name and URLs to mailchimp.

So if instead of the event name I want to parse the event category, what should I use instead of $merge_vars['EVENTNAME'] = $event->name();

function tw_eea_mailchimp_event_name( $subscribe_args, $registration, $EVT_ID ) {

    //Pull the event using EVT_ID.
    $event = EEM_Event::instance()->get_one_by_ID($EVT_ID);

    if( $event instanceof EE_Event ) {
        //Pull the merge_vars array from $subscribe_args.
        $merge_vars = $subscribe_args['merge_vars'];
        //Add the 'EVENTNAME' merge var.
        $merge_vars['EVENTNAME'] = $event->name();
        //Add the merge vars back into the subscriptions args.
        $subscribe_args['merge_vars'] = $merge_vars;

    //Return the subscribe args.
    return $subscribe_args;

add_filter('FHEE__EE_MCI_Controller__mci_submit_to_mailchimp__subscribe_args', 'tw_eea_mailchimp_event_name', 10, 3);


  • Support Staff

January 17, 2020 at 10:01 am


You can get the category object with:
$category = $event->first_event_category();

(Please note the above gets the first event category only, because there could be more than one)

Now that you have an object, you can get something that can be passed as a tag, so for example you could get the category’s slug with:

if ( $category instanceof EE_Term ) {
 $merge_vars['TAGNAME'] = $category->slug();

The support post ‘Parse event category or other parameters to Mailchimp’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

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: closed

Updated by  Josh 4 months, 2 weeks ago ago

Topic Tags



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