Tribe__Tickets_Plus__Commerce__EDD__Main::add_tickets_msg_to_email( string $email_body, int $payment_id, array $unused_payment_data )

Adds a message to EDD’s order email confirmation.


Parameters

$email_body

(string) (Required)

$payment_id

(int) (Required)

$unused_payment_data

(array) (Required)


Top ↑

Source

File: src/Tribe/Commerce/EDD/Main.php

	public function add_tickets_msg_to_email( $email_body, $payment_id, $unused_payment_data ) {

		//if( did_action( 'eddtickets-send-tickets-email' ) )
		//return $email_body;

		$order_items = edd_get_payment_meta_downloads( $payment_id );

		// Bail if the order is empty
		if ( empty( $order_items ) ) {
			return $email_body;
		}

		$has_tickets = false;

		// Iterate over each product
		foreach ( (array) $order_items as $item ) {

			$product_id = isset( $item['id'] ) ? $item['id'] : false;

			// Get the event this tickets is for
			$post_id = get_post_meta( $product_id, $this->event_key, true );

			if ( ! empty( $post_id ) ) {
				$has_tickets = true;
				break;
			}
		}
		if ( ! $has_tickets )
			return $email_body;

		$message = __( "You'll receive your tickets in another email.", 'event-tickets-plus' );
		return $email_body . '<br/>' . apply_filters( 'eddtickets_email_message', $message );

	}