Developer reference

Actions

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

Filters

Hook Default Purpose
mymentech_qrt_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
mymentech_qrt_get( $key ) / mymentech_qrt_on( $key ) A setting value / boolean.
mymentech_qrt_product_is_ticket( $product_id ) Whether a product is a ticket.
mymentech_qrt_product_seats( $product_id ) Seats per unit.
mymentech_qrt_order_ticket_ids( $order_id ) Ticket post IDs for an order.
mymentech_qrt_get_ticket_by_code( $code ) Ticket post ID or 0.
mymentech_qrt_ticket_data( $ticket_id ) Array with code, status, seats, items, attendees…
mymentech_qrt_ticket_url( $code ) / mymentech_qrt_ticket_pdf_url( $code ) Public URLs.
mymentech_qrt_issue_ticket( $order_id ) Issue (or re-sync) the ticket for an order.
mymentech_qrt_void_ticket( $ticket_id, $reason ) Void a ticket.
mymentech_qrt_checkin( $ticket_id, $count ) / mymentech_qrt_checkin_undo( $ticket_id ) Door actions.
mymentech_qrt_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.mymentech-qrt-page and the .mqrt-* classes, or by changing the three colours in settings.

Naming conventions

Thing Prefix / name
Functions mymentech_qrt_
Constants MYMENTECH_QRT_VERSION, MYMENTECH_QRT_FILE, MYMENTECH_QRT_DIR, MYMENTECH_QRT_URL, MYMENTECH_QRT_CAP, MYMENTECH_QRT_DOCS_URL
Option mymentech_qrt_settings
Post type mymentech_qrt_ticket
Capability mymentech_qrt_checkin
Meta keys _mymentech_qrt_*
Text domain mymentech-qr-tickets
Script / style handles mymentech-qrt-*

Translations

Text domain: mymentech-qr-tickets. The template is languages/mymentech-qr-tickets.pot. Once the plugin is live on WordPress.org, translations come from translate.wordpress.org as language packs and load automatically. Custom .mo files go in wp-content/languages/plugins/mymentech-qr-tickets-{locale}.mo.

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.