Tribe__Tickets__Global_Stock::tickets_sold( bool $pending = false )
Returns a count of the number of global ticket sales for this event.
Contents
Parameters
- $pending
-
(bool) (Optional) Includes Pending Tickets on the Sales total
Default value: false
Return
(int)
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;
}
Changelog
| Version | Description |
|---|---|
| 4.6 | Introduced $pending Param |
| 4.1 | Introduced. |