Developer reference

Actions HookArgumentsWhenseatpass_ticket_issued$ticket_id, WC_Order $orderA new ticket has been created for an order.seatpass_ticket_voided$ticket_id, $reasonA ticket was voided.seatpass_checked_in$ticket_id, $countGuests were checked in.seatpass_purge_cache–Ticket stock changed; clear page caches. Filters HookDefaultPurposeseatpass_ticket_email_idscustomer_processing_order, customer_completed_order,…

Actions

Hook Arguments When
seatpass_ticket_issued $ticket_id, WC_Order $order A new ticket has been created for an order.
seatpass_ticket_voided $ticket_id, $reason A ticket was voided.
seatpass_checked_in $ticket_id, $count Guests were checked in.
seatpass_purge_cache – Ticket stock changed; clear page caches.

Filters

Hook Default Purpose
seatpass_ticket_email_ids customer_processing_order, customer_completed_order, customer_invoice Which WooCommerce emails receive the ticket card and PDF attachment.

Useful functions (all in includes/)

Function Returns
seatpass_get( $key ) / seatpass_on( $key ) A setting value / boolean.
seatpass_product_is_ticket( $product_id ) Whether a product is a ticket.
seatpass_product_seats( $product_id ) Seats per unit.
seatpass_order_ticket_ids( $order_id ) Ticket post IDs for an order.
seatpass_get_ticket_by_code( $code ) Ticket post ID or 0.
seatpass_ticket_data( $ticket_id ) Array with code, status, seats, items, attendees…
seatpass_ticket_url( $code ) / seatpass_ticket_pdf_url( $code ) Public URLs.
seatpass_issue_ticket( $order_id ) Issue (or re-sync) the ticket for an order.
seatpass_void_ticket( $ticket_id, $reason ) Void a ticket.
seatpass_checkin( $ticket_id, $count ) / seatpass_checkin_undo( $ticket_id ) Door actions.
seatpass_ticket_card_html( $ticket_id, $context ) The HTML card used in emails.

Templates

templates/ticket-page.php and templates/ticket-pdf.php are wrapped in functions and receive their data as arguments. They are not theme-overridable in 1.0.0; style the web ticket with CSS targeting body.seatpass-page and the .sp-* classes, or by changing the three colours in settings.

Naming conventions

Thing Prefix / name
Functions seatpass_
Constants SEATPASS_VERSION, SEATPASS_FILE, SEATPASS_DIR, SEATPASS_URL, SEATPASS_CAP
Option seatpass_settings
Post type seatpass_ticket
Capability seatpass_checkin
Meta keys _seatpass_*
Text domain seat-pass
Script / style handles seatpass-*

Building from source

composer install --no-dev --optimize-autoloader

composer.json pins chillerlan/php-qrcode and dompdf/dompdf. The shipped vendor/ folder is pruned of tests and docs. Run the WordPress Plugin Check plugin before releasing: version 1.0.0 passes with no errors.