travel_date ?? '')); $booking_date_formatted = \Yatra\Helpers\FormatHelper::formatDateTime((string) ($booking->created_at ?? '')); // Get status color $status_colors = [ 'pending' => ['bg' => '#fef3c7', 'text' => '#d97706', 'label' => 'Pending'], 'confirmed' => ['bg' => '#d1fae5', 'text' => '#059669', 'label' => 'Confirmed'], 'processing' => ['bg' => '#dbeafe', 'text' => '#2563eb', 'label' => 'Processing'], 'completed' => ['bg' => '#d1fae5', 'text' => '#059669', 'label' => 'Completed'], 'cancelled' => ['bg' => '#fee2e2', 'text' => '#dc2626', 'label' => 'Cancelled'], 'refunded' => ['bg' => '#fce7f3', 'text' => '#db2777', 'label' => 'Refunded'], 'on_hold' => ['bg' => '#e5e7eb', 'text' => '#6b7280', 'label' => 'On Hold'], ]; $status_style = $status_colors[$booking->status] ?? $status_colors['pending']; yatra_get_header(); // Hook for Pro modules to add custom scripts (Facebook Pixel, etc.) do_action('yatra_booking_confirmation_header', $booking); ?>

status === 'confirmed') { esc_html_e('Booking Confirmed!', 'yatra'); } elseif ($booking->status === 'pending') { esc_html_e('Booking Received!', 'yatra'); } elseif ($booking->status === 'cancelled') { esc_html_e('Booking Cancelled', 'yatra'); } else { esc_html_e('Booking Submitted!', 'yatra'); } ?>

status === 'confirmed') { esc_html_e('Thank you for your booking. We look forward to hosting you!', 'yatra'); } elseif ($booking->status === 'pending') { esc_html_e('Thank you for your booking. Your booking is pending confirmation.', 'yatra'); } elseif ($booking->status === 'cancelled') { esc_html_e('This booking has been cancelled.', 'yatra'); } else { esc_html_e('Thank you for your booking submission.', 'yatra'); } ?>

reference); ?>
featured_image)) { if (is_numeric($booking->featured_image)) { $featured_image_url = wp_get_attachment_url((int) $booking->featured_image) ?: ''; } else { $featured_image_url = $booking->featured_image; } } ?>
<?php echo esc_attr($booking->trip_title); ?>

trip_title); ?>

trip_average_rating) && $booking->trip_review_count >= 0) : ?>
trip_average_rating); $has_half = ($booking->trip_average_rating - $filled_stars) >= 0.5; for ($i = 1; $i <= 5; $i++) : $class = $i <= $filled_stars ? 'yatra-star-filled' : ($has_half && $i === $filled_stars + 1 ? 'yatra-star-half' : ''); ?>
trip_average_rating, 1)); ?> trip_review_count, 'yatra')), (int) $booking->trip_review_count); ?>
duration_days)) : ?> duration_days, (int) $booking->duration_nights); ?> difficulty_level)) : ?> difficulty_level)); ?>
starting_location)) : ?>

starting_location); ?> ending_location) && $booking->ending_location !== $booking->starting_location) : ?> → ending_location); ?>

trip_destinations_list)) : ?>
trip_destinations_list as $destination) : ?>
trip_activities_list)) : ?>
trip_activities_list as $activity) : ?>
trip_categories_list)) : ?>
trip_categories_list as $category) : ?>
trip_attributes_list)) : ?>
trip_attributes_list as $attribute) : ?>

travelers_count); ?>
travelers)) : ?>

travelers as $index => $traveler) : $traveler_name = trim(($traveler['first_name'] ?? '') . ' ' . ($traveler['last_name'] ?? '')); ?>

subtotal ?? $booking->total_amount); $discount_amount = (float) ($booking->discount_amount ?? 0); $itinerary_costs_total = (float) ($booking->itinerary_costs_total ?? 0); $tax_amount = (float) ($booking->tax_amount ?? 0); $tax_inclusive = !empty($booking->tax_inclusive); $total_amount = (float) $booking->total_amount; $amount_paid = (float) ($booking->amount_paid ?? 0); $amount_due = (float) ($booking->amount_due ?? 0); // ── Tax breakdown (built first so it can gate later rows) ─ $tax_breakdown = []; if (!empty($booking->tax_details)) { $taxes = json_decode($booking->tax_details, true) ?: []; foreach ($taxes as $tax) { $tax_breakdown[] = [ 'name' => $tax['name'] ?? __('Tax', 'yatra'), 'rate' => (float) ($tax['rate'] ?? 0), 'amount' => (float) ($tax['amount'] ?? 0), ]; } } elseif ($tax_amount > 0) { $tax_breakdown[] = [ 'name' => __('Tax', 'yatra'), 'rate' => (float) ($booking->tax_rate ?? 0), 'amount' => $tax_amount, ]; } // ── Itinerary costs ─────────────────────────────────────── $itinerary_costs = []; if (!empty($booking->itinerary_costs)) { $itinerary_costs = json_decode($booking->itinerary_costs, true) ?: []; } // ── Additional services ─────────────────────────────────── $raw_services = apply_filters('yatra_booking_get_services', [], (int) ($booking->id ?? 0)); $selected_services = []; if (!empty($raw_services) && is_array($raw_services)) { foreach ($raw_services as $s) { $arr = is_array($s) ? $s : (array) $s; if (!isset($arr['selected']) || !empty($arr['selected'])) { $selected_services[] = $arr; } } } $services_total = 0.0; foreach ($selected_services as $s) { $services_total += (float) ($s['total_price'] ?? $s['calculated_price'] ?? $s['total_cost'] ?? $s['amount'] ?? $s['unit_price'] ?? $s['price'] ?? 0); } // ── Derived amounts ─────────────────────────────────────── // base_trip_cost: the trip price without services (services are embedded in db_subtotal by Pro) $base_trip_cost = $db_subtotal - $services_total; // taxable_amount: what tax is calculated on $taxable_amount = max(0.0, $db_subtotal - $discount_amount) + $itinerary_costs_total; $has_services = !empty($selected_services); $has_discount = $discount_amount > 0; $has_itinerary = !empty($itinerary_costs) && $itinerary_costs_total > 0; $has_tax = !empty($tax_breakdown); $show_taxable_row = $has_tax && ($has_discount || $has_itinerary); ?>
currency)); ?>
+
currency, false)); ?>
currency)); ?>
-currency)); ?>
currency)); ?>
currency)); ?>
+
0): ?> (%) +currency)); ?>
currency)); ?>
0 ? ' (' . esc_html($tax['rate']) . '%)' : '', esc_html(yatra_format_price($tax['amount'], $booking->currency)) ); ?>
0): ?>
currency)); ?>
0): ?>
currency)); ?>
payment_gateway))); ?>

contact_data)) { $contact_data = json_decode($booking->contact_data, true) ?: []; } $contact_name = trim(( $contact_data['first_name'] ?? $booking->contact_first_name ?? ($booking->contact['first_name'] ?? '') ) . ' ' . ( $contact_data['last_name'] ?? $booking->contact_last_name ?? ($booking->contact['last_name'] ?? '') )); $contact_email = $contact_data['email'] ?? $booking->contact_email ?? ($booking->contact['email'] ?? ''); $contact_phone = $contact_data['phone'] ?? $booking->contact_phone ?? ($booking->contact['phone'] ?? ''); ?>

1

2

3

findLatestByBookingId((int) $booking->id); if ($latestPayment && in_array($latestPayment->status, ['completed', 'paid'], true)) : $invoiceToken = \Yatra\Controllers\PaymentGatewayController::issueInvoiceToken( (int) $latestPayment->id, (int) ($latestPayment->booking_id ?? $booking->id) ); $invoiceUrl = add_query_arg( [ 'download' => '1', 'invoice_token' => $invoiceToken, ], rest_url('yatra/v1/payment/' . (int) $latestPayment->id . '/invoice') ); ?>