Skip to content
Free

PHP hooks reference

The actions and filters Tourivo and Tourivo Pro expose, with examples.

1 min read Updated

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#

ActionFires when
tourivo/booking_createdA booking is saved.
tourivo/booking_status_changedStatus changes (booking id, old, new).
tourivo/booking_cancel_requestedA traveler asks to cancel.
tourivo/booking_email_verifiedThe traveler confirms the email.
tourivo/payment_recordedA payment is recorded.
tourivo/payment_reference_submittedA traveler submits a transfer reference.
tourivo/availability_updatedInventory changes.
tourivo/inquiry_createdAn inquiry arrives.
tourivo/loadedTourivo is ready.

Pricing filters#

FilterUse
tourivo/booking_priceChange an item’s quote; return adjustments (title, amount) to itemise.
tourivo/booking_adjustmentsAdd booking-wide price lines.
tourivo/booking_titleName a booking (packages use it).
tourivo/default_booking_statusStatus for new bookings.
tourivo/public_payment_methodsRegister a payment method for public bookings.
tourivo/currency_ratesExchange 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.