You can use this custom snippet to sync your ticket’s Event Category with the WooCommerce Product category.

Plugins

Usage

You just need to have the same categories under Event Categories and Product Categories with the same slug to make this snippet work.

So, if you have an event with a category of slug online-events and you have a Product category created with the same slug online-events then once you create a Ticket for that event that ticket product will get the same product category automatically.

This will work the same way for syncing tags.

Snippet

/**
 * Description:  Sync Event Tickets tag and category with WooCommerce product category and tag - depends on the slug
 * Usage:        Copy the snippet into your child theme's functions.php file.
 *               Change delimiter as per your needs.
 *               Make sure that the slug is same for both tag or both category to sync properly
 *
 * Last updated: March 31, 2020
 *
 * @link https://gist.github.com/rafsuntaskin/ce0d2b5cbd35379a83ad020d630f6031
 * @link https://theeventscalendar.com/knowledgebase/k/sync-event-category-with-ticket-product-category/
 */
add_action( 'event_tickets_after_save_ticket', 'rt_sync_et_ticket_category_with_woo', 11, 4 );

function rt_sync_et_ticket_category_with_woo( $post_id, $ticket, $raw_data, $class_name ) {

	//hardcoded for WooCommerce only
	if ( 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main' != $class_name ) {
		return;
	}

	if ( ! class_exists( 'Tribe__Events__Main' ) ) {
		return;
	}

	//get Event categories
	$tribe_ecp  = Tribe__Events__Main::instance();
	$terms      = get_the_terms( $post_id, $tribe_ecp->get_event_taxonomy() );
	$term_slugs = wp_list_pluck( $terms, 'slug' );

	//get event tags
	$event_tags = wp_get_post_tags( $post_id, 'post_tag' );
	$tag_slugs  = wp_list_pluck( $event_tags, 'slug' );

	//bail out if not a valid ticket
	if ( empty( $ticket ) || ! isset( $ticket->ID ) ) {
		return;
	}

	//process if event has categories
	if ( ! empty( $term_slugs ) ) {
		foreach ( $term_slugs as $cat ) {
			wp_add_object_terms( $ticket->ID, $cat, 'product_cat' );
		}
	}

	//process if event has tags
	if ( ! empty( $tag_slugs ) ) {
		wp_add_post_tags( $ticket->ID, $tag_slugs );
	}
}