travel_date)); $booking_date_formatted = date_i18n(get_option('date_format') . ' ' . get_option('time_format'), strtotime($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) ? (float) $booking->subtotal : (float) $booking->total_amount; $tax_amount = !empty($booking->tax_amount) ? (float) $booking->tax_amount : 0; $tax_inclusive = !empty($booking->tax_inclusive); // If tax is inclusive, subtotal should be total_amount, otherwise calculate it if (!$tax_inclusive && $tax_amount > 0) { $subtotal = $booking->total_amount - $tax_amount; } ?>
currency)); ?>
discount_amount) && $booking->discount_amount > 0) : ?>
-discount_amount, $booking->currency)); ?>
itinerary_costs)) { $itinerary_costs = json_decode($booking->itinerary_costs, true) ?: []; } if (!empty($itinerary_costs)): ?>
currency)); ?>
itinerary_costs_total)) { // Calculate taxable amount: discounted subtotal + itinerary costs $discounted_subtotal = $subtotal - ($booking->discount_amount ?? 0); $taxable_amount = $discounted_subtotal + (float) $booking->itinerary_costs_total; } if ($taxable_amount > 0 && !empty($tax_breakdown)): ?>
currency)); ?>
tax_details)) { $taxes = json_decode($booking->tax_details, true) ?: []; foreach ($taxes as $tax) { $tax_breakdown[] = [ 'name' => $tax['name'] ?? 'Tax', 'rate' => $tax['rate'] ?? 0, 'amount' => $tax['amount'] ?? 0 ]; } } elseif (!empty($booking->tax_amount) && $booking->tax_amount > 0) { // Fallback for single tax $tax_breakdown[] = [ 'name' => __('Tax', 'yatra'), 'rate' => (float) ($booking->tax_rate ?? 0), 'amount' => (float) $booking->tax_amount ]; } if (!empty($tax_breakdown)): ?>
(%) currency)); ?>
total_amount, $booking->currency)); ?>
amount_paid ?? 0) > 0) : ?>
amount_paid, $booking->currency)); ?>
amount_due > 0) : ?>
amount_due, $booking->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)) : ?>