Support

Home Forums MailChimp Integration Issue with submitting mergefields to Mailchimp

Issue with submitting mergefields to Mailchimp

Posted: January 9, 2017 at 12:59 pm


Railpromo

January 9, 2017 at 12:59 pm

Dear team,

Referring to this thread: https://eventespresso.com/topic/ticket-url-to-mailchimp/

This worked well for a couple of months, but since a week or two the mergefields are no longer filled in Mailchimp.

On my side I did not change anything in the plugins. I did change the structure of the lists in Mailchimp, but that’s reflected well in the event setup page and all other data (name, mail address, phone number) is stored correctly in Mailchimp.

This is the custom code included in the custom code plugin:

//This function passes the next upcoming datetime start_date within the subscribe call to MailChimp.
//You need to add a EVENTDATE merge var to your mailchimp list for this to work.


function tw_eea_mailchimp_start_date( $subscribe_args, $registration, $EVT_ID ) {
	//Check we have a valid EE Registration
	if( $registration instanceof EE_Registration ) {
		
		//Pull the merge_vars array from $subscribe_args.
		$merge_vars = $subscribe_args['merge_vars'];
		//Pull the datetimes assigned to this ticket that have a start date greater than today.
		$where = array( 'DTT_EVT_start' => array( '>=', current_time( 'mysql' ) ) );
		$datetimes = $registration->ticket()->datetimes( array( $where,	'order_by'=> array('DTT_EVT_start' => 'ASC' ) ) );
		//Use the first datetime.
		$datetime = reset($datetimes);
		//Add the 'EVENTDATE' merge var and use the datetimes start_date for the value.
		$merge_vars['EVENTDATE'] = $datetime->start_date( 'Y-m-d' );
		//Add the
		$reg_url_link = $registration->reg_url_link();
		$merge_vars['URLPART'] = $reg_url_link;
		//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_start_date', 10, 3);

I’m using:
Event Espresso 4.9.22.p
Event Espresso – MailChimp (EE4.4.5+) 2.3.3.p

Any thoughts on what could cause this?

Best,
Luc


Tony

  • Support Staff

January 9, 2017 at 1:17 pm

Hi Luc,

So if you place a registration now the registration is added to the list but BOTH the merge vars have no values in MailChimp?

What option do you have set for the ‘Submit to MailChimp when …’ option in Mailchimp Settings?


Railpromo

January 9, 2017 at 1:34 pm

Dear Tony,

Indeed, that’s true. All standard fields are submitted, but the two mergefields aren’t.
The setting is “registration is completed with an approved status”, as it was before.

Best,
Luc


Tony

  • Support Staff

January 12, 2017 at 2:47 pm

Found the problem, it was an issue with the code in the latest updated.

We’ve pushed a new version of the EE4 MailChimp plugin with a fix for this, if you don’t see it on your site currently go to Event Espresso -> General Settings and save the settings.


Railpromo

January 13, 2017 at 12:50 am

Dear Tony,
Thanks; that’s good news. I however don’t see the update. Do I have to manually download it from your site?


Tony

  • Support Staff

January 13, 2017 at 6:10 am

Did you click save within general settings?

You shouldn’t need to manually update and should see the update for the MailChimp add-on within the plugins menu.


Railpromo

January 13, 2017 at 7:50 am

Yes, I did. I only saw (and see) an update from the Mailmunch plugin but nothing from your side…


Tony

  • Support Staff

January 13, 2017 at 8:39 am

I’m not sure why its not showing on your site but tn that case you may need to update manually.

I can’t see any issue with your account and can see the current version pinged our servers and the new version number passed back (which should inform you of an update).


Railpromo

January 17, 2017 at 2:39 am

Dear Tony,

The update showed up yesterday. Thanks.
Is there a way to regenerate the missing data, especially the “URLPART” with the link to the tickets? I somehow have to retrieve this for about 14 registrations.

Best,
Luc


Tony

  • Support Staff

January 17, 2017 at 2:53 am

You can’t regenerate but you can add the details manually to the subscribers.

View the registrations in the EE registrations list and use the ticket icon to view the ticket – http://take.ms/GdeqK

The token from the URL can be added to the subscriber – http://take.ms/q0E6J

The event date can be taken from the event.

To edit your subscribers, view the MailChimp list and click on the subscriber, then click to edit the answers – http://take.ms/zVwLN

The support post ‘Issue with submitting mergefields 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