Tribe__Tickets__Ticket_Object::capacity()

Gets the Capacity for the Ticket


Return

(int)


Top ↑

Source

File: src/Tribe/Ticket_Object.php

		public function capacity() {
			if ( ! $this->managing_stock() ) {
				return '';
			}

			if ( is_null( $this->capacity ) ) {
				$this->capacity = tribe_tickets_get_capacity( $this->ID );
			}

			$stock_mode = $this->global_stock_mode();

			// Unlimited is always unlimited
			if ( -1 === (int) $this->capacity ) {
				return (int) $this->capacity;
			}

			// If Capped or we used the local Capacity
			if (
				Tribe__Tickets__Global_Stock::CAPPED_STOCK_MODE === $stock_mode
				|| Tribe__Tickets__Global_Stock::OWN_STOCK_MODE === $stock_mode
			) {
				return (int) $this->capacity;
			}

			$event_capacity = tribe_tickets_get_capacity( $this->get_event() );

			return (int) $event_capacity;
		}

Top ↑

Changelog

Changelog
Version Description
4.6 Introduced.