Tribe__Tickets__Commerce__PayPal__Main::get_qty_pending( int $ticket_id, bool $refresh = false )

Returns the number of pending attendees by ticket.


Parameters

$ticket_id

(int) (Required) The ticket post ID

$refresh

(bool) (Optional) Whether to try and use the cached value or not.

Default value: false


Top ↑

Return

(int)


Top ↑

Source

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

	public function get_qty_pending( $ticket_id, $refresh = false ) {
		if ( $refresh || empty( $this->pending_attendees_by_ticket[ $ticket_id ] ) ) {
			$pending_query = new WP_Query( array(
				'fields'     => 'ids',
				'per_page'   => 1,
				'post_type'  => self::ATTENDEE_OBJECT,
				'meta_query' => array(
					array(
						'key'   => self::ATTENDEE_PRODUCT_KEY,
						'value' => $ticket_id,
					),
					'relation' => 'AND',
					array(
						'key'   => $this->attendee_tpp_key,
						'value' => Tribe__Tickets__Commerce__PayPal__Stati::$pending,
					),
				),
			) );

			$this->pending_attendees_by_ticket[ $ticket_id ] = $pending_query->found_posts;
		}

		return $this->pending_attendees_by_ticket[ $ticket_id ];
	}

Top ↑

Changelog

Changelog
Version Description
4.7 Introduced.