Run code after a booking is imported or updated

Use the woocommerce_bookings_import_inserted_booking_object action to run follow-up logic after the importer has saved a booking. At this point the booking object has already been created or updated, so the hook is useful for logging, notifications, or syncing related systems. The snippet below writes a WooCommerce log entry that includes the booking ID, whether it was created or updated, and how many mapped fields were processed.

add_action(
	'woocommerce_bookings_import_inserted_booking_object',
	function ( WC_Booking $booking, array $data, bool $updating ): void {
		$logger = wc_get_logger();
		$action = $updating ? 'updated' : 'created';

		$logger->info(
			sprintf(
				'Booking %1$d was %2$s from a CSV import with %3$d mapped fields.',
				$booking->get_id(),
				$action,
				count( $data )
			),
			array( 'source' => 'bookings-import' )
		);
	},
	10,
	3
);
Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.