Support

Home Forums Event Espresso Premium Send Ticket Name to Mailchimp

Send Ticket Name to Mailchimp

Posted: September 9, 2022 at 8:10 am

Viewing 2 reply threads


Brooke

September 9, 2022 at 8:10 am

Hi,

I’ve been sending eventdate and datetime name to Mailchimp using the snippet on github linked below, but I need to send the ticket name as well. Can you let me know what it would take to do that?

Thanks, Brooke

https://github.com/eventespresso/ee-code-snippet-library/blob/master/addons/eea-mailchimp/tw_eea_mailchimp_event_name.php


Joao Victor

  • Support Staff

September 9, 2022 at 12:53 pm

Hi Brooke!

Thanks for contacting us.
You will need to update the added snippet by the following custom code:


function tw_eea_mailchimp_event_ticket_name( $subscribe_args, $registration, $EVT_ID ) {
//Pull the merge_vars array from $subscribe_args.
$merge_vars = $subscribe_args['merge_vars'];

$ticket = $registration->ticket();

if($ticket instanceof EE_Ticket) {
	//Add the 'TKTNAME' merge var.
    $merge_vars['TKTNAME'] = $ticket->name();	
}

$event = $registration->event();
if($event instanceof EE_Event) {
	//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 $subscribe_args;
}
add_filter('FHEE__EE_MCI_Controller__mci_submit_to_mailchimp__subscribe_args', 'tw_eea_mailchimp_event_ticket_name', 10, 3);

Remember to add the “TKTNAME” under your merge fields on Mailchimp > Audience > Settings > Audience fields and *|MERGE|* tags as a text field.

Let me know if it works!


Brooke

September 11, 2022 at 9:02 am

Thank Joao, You’re a star, that worked like a dream.

Viewing 2 reply threads

The support post ‘Send Ticket Name 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.

Event Espresso