Ticket
Whenever you’re dealing with a ticket in your template, you’re actually working with a Ticket object.
Properties
Type: int|null
The ID of the ticket.
Type: string|null
The ticket title.
Type: Event|null
The ticket’s associated Event.
Type: int|null
The ID of the event this ticket belongs to.
Type: TicketType|null
The ticket’s associated ticket type.
Type: int|null
The ID of the ticket’s type.
The SKU (Stock Keeping Unit) of the ticket.
Type: float
The listing price of the ticket.
Methods
Returns the URL to edit this ticket in the control panel.
Returns: bool
Whether this ticket is available for purchase. This will be true unless the 'Available From/To' dates do not match the current time, or if the ticket has been fully purchased.
Read Session and Type Details
Use ticket.stock for the number of whole tickets available to purchase and ticket.remainingSeats for the number of seats remaining. They differ when a ticket admits more than one person. Capacity and purchased-seat counts continue to use seats.
A Ticket combines a session and a ticket type. Read the date from its session and the sale window from its type. For example, in a template where ticket is a Ticket returned by a ticket query:
{% if ticket.session %}
<p>{{ ticket.session.startDate | date('medium') }}</p>
{% endif %}
{% if ticket.type and ticket.type.availableFrom %}
<p>Available from {{ ticket.type.availableFrom | date('medium') }}</p>
{% endif %}Use the cart or order line item for the quantity being purchased. A generated Ticket is the purchasable definition, not a customer's line-item quantity.