findByCheckoutToken($token); if (!$booking) { wp_die(__('Invalid checkout link.', 'yatra')); } // Configure $wp_query + virtual WP_Post so FSE block themes don't fall back to 404.html. $this->setupPageEnvironment('singular', [ 'title' => __('Checkout', 'yatra'), 'object_id' => (int) ($booking->id ?? 0), 'post_type' => 'page', 'post_name' => $token, ]); // Set up global booking object $this->setGlobal('yatra_booking', $booking); // Set up query vars for backward compatibility $this->setQueryVars([ 'yatra_remaining_checkout' => $token, 'yatra_booking' => $booking, ]); return $this->selectTemplate('checkout', null, 'checkout'); } }