Tribe__Tickets__Ticket_Object::available()

Provides the quantity of Available tickets based on the Attendees number

See also


Top ↑

Return

(int)


Top ↑

Source

File: src/Tribe/Ticket_Object.php

		public function available() {
			// if we aren't tracking stock, then always assume it is in stock or capacity is unlimited
			if ( ! $this->managing_stock() || -1 === $this->capacity() ) {
				return -1;
			}

			$values[] = $this->inventory();
			$values[] = $this->capacity();
			$values[] = $this->stock();

			// What ever is the lowest we use it
			$available = min( $values );

			// Prevents Negative
			return max( $available, 0 );
		}

Top ↑

Changelog

Changelog
Version Description
4.6 Introduced.