Tribe__Tickets__Tickets_Handler::has_unlimited_stock( $post = null,  $stock_mode = null,  $provider_class = null )

Checks if there are any unlimited tickets, optionally by stock mode or ticket type


Parameters

(string) (Required) (null) $provider_class the ticket provider class ex: Tribe__Tickets__RSVP


Top ↑

Return

(boolean) whether there is a ticket (within the provided parameters) with an unlimited stock


Top ↑

Source

File: src/Tribe/Tickets_Handler.php

	public function has_unlimited_stock( $post = null, $stock_mode = null, $provider_class = null ) {
		$post_id = Tribe__Main::post_id_helper( $post );
		$tickets = Tribe__Tickets__Tickets::get_event_tickets( $post_id );

		foreach ( $tickets as $index => $ticket ) {
			// Eliminate tickets by stock mode
			if ( ! is_null( $stock_mode ) && $ticket->global_stock_mode() !== $stock_mode ) {
				unset( $tickets[ $ticket ] );
				continue;
			}

			// Eliminate tickets by provider class
			if ( ! is_null( $provider_class ) && $ticket->provider_class !== $provider_class ) {
				unset( $tickets[ $ticket ] );
				continue;
			}

			if ( $this->is_unlimited_ticket( $ticket ) ) {
				return true;
			}
		}

		return false;
	}

Top ↑

Changelog

Changelog
Version Description
4.6 Introduced.