Free
PHP hooks reference
The actions and filters Tourivo and Tourivo Pro expose, with examples.
On this page
Tourivo’s hooks use slash names: tourivo/… in the free plugin, tourivo_pro/… in Pro. Tourivo Pro itself is built on these hooks.
Booking actions#
| Action | Fires when |
|---|---|
tourivo/booking_created | A booking is saved. |
tourivo/booking_status_changed | Status changes (booking id, old, new). |
tourivo/booking_cancel_requested | A traveler asks to cancel. |
tourivo/booking_email_verified | The traveler confirms the email. |
tourivo/payment_recorded | A payment is recorded. |
tourivo/payment_reference_submitted | A traveler submits a transfer reference. |
tourivo/availability_updated | Inventory changes. |
tourivo/inquiry_created | An inquiry arrives. |
tourivo/loaded | Tourivo is ready. |
Pricing filters#
| Filter | Use |
|---|---|
tourivo/booking_price | Change an item’s quote; return adjustments (title, amount) to itemise. |
tourivo/booking_adjustments | Add booking-wide price lines. |
tourivo/booking_title | Name a booking (packages use it). |
tourivo/default_booking_status | Status for new bookings. |
tourivo/public_payment_methods | Register a payment method for public bookings. |
tourivo/currency_rates | Exchange rates for the switcher. |
Example: a weekday deal#
add_filter( 'tourivo/booking_adjustments', function ( $lines, $data, $quote ) {
if ( (int) wp_date( 'N' ) < 6 ) {
$lines[] = [ 'title' => 'Weekday deal', 'total' => -0.05 * (float) $quote['total'] ];
}
return $lines;
}, 10, 3 );
Example: sync to a CRM#
add_action( 'tourivo/booking_status_changed', function ( $id, $old, $new ) {
if ( 'confirmed' === $new ) {
// Send to your CRM.
}
}, 10, 3 );
Other useful filters#
tourivo/locate_template, tourivo/template_args, tourivo/send_email, tourivo/webhook_payload, tourivo/schema/tour, tourivo/schema/hotel, tourivo/use_bangla_digits, tourivo/travel_homepage, tourivo/infants_use_capacity, tourivo/trusted_proxies.
Tourivo Pro#
tourivo_pro/module_enabled, tourivo_pro/document_data, tourivo_pro/document_template, tourivo_pro/send_message, tourivo_pro/message_gateway, tourivo_pro/direct_gateways, tourivo_pro/wc_unpaid_order_timeout_minutes; actions tourivo_pro/ical_conflicts and tourivo_pro/pdf_render_failed.