Block::get_tickets( int $post_id )

Get all tickets for event/post, other than RSVP type because they’re presented in a separate block.


Parameters

$post_id

(int) (Required) Post ID.


Top ↑

Return

(array)


Top ↑

Source

File: src/Tickets/Blocks/Tickets/Block.php

	public function get_tickets( $post_id ) {
		$all_tickets = Tickets::get_all_event_tickets( $post_id );

		if ( ! $all_tickets ) {
			return [];
		}

		/** @var RSVP $rsvp */
		$rsvp = tribe( 'tickets.rsvp' );

		$tickets = [];

		// We only want RSVP tickets.
		foreach ( $all_tickets as $ticket ) {
			if (
				! $ticket instanceof Ticket_Object
				|| $rsvp->class_name === $ticket->provider_class
			) {
				continue;
			}

			$tickets[] = $ticket;
		}

		return $tickets;
	}

Top ↑

Changelog

Changelog
Version Description
4.9 Introduced.