Note: As of The Events Calendar 6.3.1, this feature is now included in the plugin, and the snippet in this article is no longer needed.

Meetup uses a 2-letter code to store country names. However, The Events Calendar needs the full name to be saved. This snippet makes the necessary adjustments during the import.

<?php
/**
 * Change the 2-letter country code to the full country name when importing from Meetup.
 * Meetup saves the country names with their 2-letter code (alpha2code). However, The Events Calendar 
 * needs the full name to be saved. This snippet makes that adjustment.
 *
 * Plugins required: The Events Calendar
 * Author: Andras Guseo
 * Last updated: December 19, 2023
 *
 * @version 6.0.9
 */

add_action ( 'tribe_events_venue_created', 'tec_fix_meetup_venue_country' );

function tec_fix_meetup_venue_country ( $venue_id ) {

	// Get the origin.
	$origin = get_post_meta( $venue_id, '_VenueOrigin', true, );

	// Bail if the venue is not imported.
	if ( $origin != 'event-aggregator' ) {
		return;
	}

	// Get the venue.
	$venue = tribe_get_venue_object( $venue_id );

	// Get the country code of the venue.
	$country = strtoupper( $venue->country );

	// Get the country array from Tribe Common.
	$countries = tribe( \Tribe__Languages__Locations::class )->build_country_array();

	// If the country code of the venue exists, then change it to the full country name from the array.
	if ( array_key_exists( $country, $countries ) ) {
		// On some servers the country update needs to wait... :(
		// You can try to remove this line, and see if it works.
		// If it doesn't work, then add back.
		sleep(5);
		
		// Update country.
		update_post_meta( $venue_id, '_VenueCountry', $countries[ $country ] );
		
		// Make sure we have a state.
		if ( $country == 'US' ) {
			update_post_meta( $venue_id, '_VenueState', $venue->province );
		}
	}
}

Detailed Instructions on How to Implement the Code Snippet

First, browse to Plugins – Add New Plugin. Search for Code Snippets by Code Snippets Pro. It should be the first result. Install and activate the plugin. Once activated, browse to Code Snippets – Add New. In this example, we’re naming the snippet Meetup Country Code Fix.

Copy the snippet from the Knowledgebase article and paste it into the Code Editor. Note, you’ll need to remove the first line from the snippet as the Code Snippet plugin adds it automatically.

Check the option to run the snippet everywhere, scroll to the bottom of the page and click the Save Changes and Activate button. This will enable the code snippet.

User interface for adding a code snippet to the code snippets plugin

Note, that to import events from Meetup into The Events Calender, you’ll need an active license key for Event Aggregator, which is a premium add-on.

Browse to Events – Import. Select Meetup from the Import Origin. If you haven’t already, you’ll be prompted to connect your site to Meetup.com. In this example, we’re importing one event. Once Meetup is connected, select One-Time Import from the Import Type Dropdown. Copy the URL from a Meetup event that takes place in a physical location and paste it into the URL box. Click the Preview button, then click the Import All Button. This will import the event and add the necessary data into The Events Calendar. 

A series of fields related to the user interface for Event Automator when importing an event from Meetup.com into The Events Calendar.

Click on the Venues link and select the venue associated with the event that you imported. In the backend, the Country and State if applicable, should be part of the venue information. The full country name should be displayed on the frontend of the site.

Information that displays the address, city, country, state or province, and postal code of a venue

Note that the team is aware of this bug and a fix will be coming soon. If you run into any issues importing events from Meetup.com into The Events Calendar, please contact our Support team.