Tribe__Tickets__Global_Stock::tickets_sold( bool $pending = false )

Returns a count of the number of global ticket sales for this event.


Parameters

$pending

(bool) (Optional) Includes Pending Tickets on the Sales total

Default value: false


Top ↑

Return

(int)


Top ↑

Source

File: src/Tribe/Global_Stock.php

	public function tickets_sold( $pending = false ) {
		$sales = 0;
		$tickets = tribe( 'tickets.handler' )->get_event_shared_tickets( $this->post_id );

		foreach ( $tickets as $ticket ) {
			$sales += (int) $ticket->qty_sold();

			// Allow for fetching the pending with the Sold ones
			if ( true === (bool) $pending ) {
				$sales += (int) $ticket->qty_pending();
			}
		}

		return $sales;
	}

Top ↑

Changelog

Changelog
Version Description
4.6 Introduced $pending Param
4.1 Introduced.