Tribe__Tickets_Plus__Commerce__EDD__Stock_Control::available_units( int $ticket_id )
Returns the amount of inventory available for the specified ticket.
Contents
Parameters
- $ticket_id
-
(int) (Required)
Return
(int)
Source
File: src/Tribe/Commerce/EDD/Stock_Control.php
public function available_units( $ticket_id ) {
// Do we have a limit on the number of tickets?
$limit = get_post_meta( $ticket_id, '_stock', true );
if ( empty( $limit ) ) return Tribe__Tickets_Plus__Commerce__EDD__Main::UNLIMITED;
// If so, calculate the number still available
$sold = $this->get_purchased_inventory( $ticket_id );
return $limit - $sold;
}
Changelog
| Version | Description |
|---|---|
| 4.10.7 | Introduced. |