Availability

How to query

You can query availability from your templates using craft.availability. While some of the syntax is similar this does not return an Element Query.

craft.availability(event).all()

Parameters

ticket(Ticket|null)

Check availability for the given ticket of the event.

{% set query = craft.availability(entry.eventField).ticket(entry.variants.one().ticketField) %}

start(DateTime|string|null)

Query availability from the given date. Must either be or be parse-able by DateTime.

{% set query = craft.availability(entry.eventField).start(now|date_modify('-1 week')) %}

end(DateTime|string|null)

Query availability until the given date. Must either be or be parse-able by DateTime.

{% set query = craft.availability(entry.eventField).end(now|date_modify('+1 week')) %}

limit(int|null)

Limit the number of slots by the given amount. Will be ignored if end is set.

{% set query = craft.availability(entry.eventField).limit(10) %}

groupBy(string|null)

Group the results by a given frequency.

Allowed Frequencies:

  • hour
  • day
  • week
  • month
  • year
{% set query = craft.availability(entry.eventField).groupBy('day') %}