PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.16
Yatra – Travel Booking & Tour Operator Software v3.0.16
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
← All changes | templates/partials/booking-form-fields.php +192 -41 3.0.5.1 → 3.0.16 View file →
@@ -30,9 +30,11 @@
30 30 // Check if Dynamic Form Field module is enabled (Pro feature)
31 31 $is_dynamic_form_enabled = apply_filters('yatra_dynamic_form_field_enabled', false);
32 32
33 33 // Get form configuration - returns default config if module disabled, custom config if enabled
34 -$form_config = yatra_get_booking_form_config();
34 +// Scoped to the trip being booked, so a field or section limited to certain
35 +// trips (Pro) is neither rendered nor required here.
36 +$form_config = yatra_get_booking_form_config(!empty($trip_id) ? (int) $trip_id : null);
35 37
36 38
37 39 // Country list — pulls from the canonical FormatHelper source so every
38 40 // dropdown (admin, public booking, Pro modules) shows the same full
@@ -53,9 +55,27 @@
53 55 function yatra_render_form_field($field, $prefix = '', $countries = [], $custom_name = null, $custom_id = null) {
54 56 if (empty($field['enabled'])) {
55 57 return;
56 58 }
57 -
59 +
60 + // Display-only text block: render admin-authored content (safe HTML) at this
61 + // position between fields. It is NOT an input — no label, name, value or
62 + // required handling — so it submits nothing and is never validated.
63 + if (($field['type'] ?? '') === 'text_block') {
64 + $tb_width = 'yatra-field-full';
65 + if (($field['width'] ?? '') === 'half') {
66 + $tb_width = 'yatra-field-half';
67 + } elseif (($field['width'] ?? '') === 'third') {
68 + $tb_width = 'yatra-field-third';
69 + }
70 + ?>
71 + <div class="yatra-form-group yatra-form-text-block <?php echo esc_attr($tb_width); ?>" data-applies-to="<?php echo esc_attr($field['applies_to'] ?? 'all'); ?>">
72 + <?php echo wpautop(wp_kses_post(yatra_translate_form_string($field['content'] ?? ''))); ?>
73 + </div>
74 + <?php
75 + return;
76 + }
77 +
58 78 $field_id = $custom_id ? esc_attr($custom_id) : esc_attr($prefix . $field['id']);
59 79 $field_name = $custom_name ? esc_attr($custom_name) : esc_attr($prefix . $field['id']);
60 80 $required = !empty($field['required']);
61 81 $required_attr = $required ? 'required' : '';
@@ -86,12 +106,12 @@
86 106 }
87 107 }
88 108 $field_type = $field['type'] ?? 'text';
89 109 ?>
90 - <div class="yatra-form-group <?php echo esc_attr($width_class); ?> <?php echo $field_type === 'checkbox' ? 'yatra-form-group--checkbox' : ''; ?>">
110 + <div class="yatra-form-group <?php echo esc_attr($width_class); ?> <?php echo $field_type === 'checkbox' ? 'yatra-form-group--checkbox' : ''; ?>" data-applies-to="<?php echo esc_attr($field['applies_to'] ?? 'all'); ?>">
91 111 <?php if ($field_type !== 'checkbox') : ?>
92 112 <label for="<?php echo $field_id; ?>">
93 - <?php echo esc_html($field['label']); ?> <?php echo $required_star; ?>
113 + <?php echo esc_html(yatra_translate_form_string($field['label'])); ?> <?php echo $required_star; ?>
94 114 </label>
95 115 <?php endif; ?>
96 116 <?php
97 117 switch ($field['type']) {
@@ -106,9 +126,9 @@
106 126 value="1"
107 127 <?php checked($is_checked, true, false); ?>
108 128 <?php echo $required_attr; ?>
109 129 />
110 - <span><?php echo esc_html($field['label']); ?><?php echo $required_star; ?></span>
130 + <span><?php echo esc_html(yatra_translate_form_string($field['label'])); ?><?php echo $required_star; ?></span>
111 131 </label>
112 132 <?php
113 133 break;
114 134 case 'select':
@@ -113,13 +133,13 @@
113 133 break;
114 134 case 'select':
115 135 ?>
116 136 <select id="<?php echo $field_id; ?>" name="<?php echo $field_name; ?>" <?php echo $required_attr; ?>>
117 - <option value=""><?php echo esc_html($field['placeholder'] ?? __('Select...', 'yatra')); ?></option>
137 + <option value=""><?php echo esc_html(yatra_translate_form_string($field['placeholder'] ?? '') ?: __('Select...', 'yatra')); ?></option>
118 138 <?php if (!empty($field['options'])) : ?>
119 139 <?php foreach ($field['options'] as $option) : ?>
120 140 <option value="<?php echo esc_attr($option['value']); ?>" <?php echo selected($prefill_value, (string) ($option['value'] ?? ''), false); ?>>
121 - <?php echo esc_html($option['label']); ?>
141 + <?php echo esc_html(yatra_translate_form_string($option['label'] ?? '')); ?>
122 142 </option>
123 143 <?php endforeach; ?>
124 144 <?php endif; ?>
125 145 </select>
@@ -126,11 +146,18 @@
126 146 <?php
127 147 break;
128 148
129 149 case 'country':
150 + // Flag base is handed to the field (same contract as the phone
151 + // widget) so country-select.js can build flag URLs without
152 + // knowing the plugin URL. The select still renders and submits
153 + // normally — the widget is a progressive enhancement over it.
154 + $country_flag_base = \defined('YATRA_PLUGIN_URL') ? YATRA_PLUGIN_URL . 'assets/img/flags/' : '';
130 155 ?>
131 - <select id="<?php echo $field_id; ?>" name="<?php echo $field_name; ?>" <?php echo $required_attr; ?>>
132 - <option value=""><?php echo esc_html($field['placeholder'] ?? __('Select Country', 'yatra')); ?></option>
156 + <select id="<?php echo $field_id; ?>" name="<?php echo $field_name; ?>" <?php echo $required_attr; ?>
157 + data-yatra-country-select
158 + data-flag-base="<?php echo esc_url($country_flag_base); ?>">
159 + <option value=""><?php echo esc_html(yatra_translate_form_string($field['placeholder'] ?? '') ?: __('Select Country', 'yatra')); ?></option>
133 160 <?php foreach ($countries as $code => $name) : ?>
134 161 <option value="<?php echo esc_attr($code); ?>" <?php echo selected($prefill_value, (string) $code, false); ?>>
135 162 <?php echo esc_html($name); ?>
136 163 </option>
@@ -143,9 +170,9 @@
143 170 ?>
144 171 <textarea
145 172 id="<?php echo $field_id; ?>"
146 173 name="<?php echo $field_name; ?>"
147 - placeholder="<?php echo esc_attr($field['placeholder'] ?? ''); ?>"
174 + placeholder="<?php echo esc_attr(yatra_translate_form_string($field['placeholder'] ?? '')); ?>"
148 175 <?php echo $required_attr; ?>
149 176 rows="3"
150 177 ><?php echo esc_textarea($prefill_value); ?></textarea>
151 178 <?php
@@ -152,14 +179,33 @@
152 179 break;
153 180
154 181 case 'date':
155 182 $min_attr = '';
183 + // Date-of-birth-style fields are bounded to today and flagged so
184 + // booking.js can upgrade them to a picker with fast year jumping
185 + // (a native date popup steps one month at a time). The class is
186 + // the JS hook; if JS/flatpickr is unavailable the input stays a
187 + // working native <input type="date">.
188 + $is_dob = (stripos($field_id, 'birth') !== false || stripos($field_id, 'dob') !== false
189 + || stripos($field_name, 'birth') !== false || stripos($field_name, 'dob') !== false);
190 + $dob_attr = $is_dob ? ' data-yatra-dob="1" max="' . esc_attr(date('Y-m-d')) . '"' : '';
191 + // Native date inputs ignore the placeholder, but once booking.js
192 + // upgrades the field to a flatpickr text input the placeholder is
193 + // what keeps it visually consistent with the other text fields
194 + // (otherwise it renders blank). Use the field's own placeholder
195 + // when set, else a format hint matching flatpickr's Y-m-d output.
196 + $date_placeholder = !empty($field['placeholder'])
197 + ? yatra_translate_form_string($field['placeholder'])
198 + : 'YYYY-MM-DD';
156 199 ?>
157 - <input
158 - type="date"
159 - id="<?php echo $field_id; ?>"
200 + <input
201 + type="date"
202 + class="yatra-js-date"
203 + id="<?php echo $field_id; ?>"
160 204 name="<?php echo $field_name; ?>"
205 + placeholder="<?php echo esc_attr($date_placeholder); ?>"
161 206 <?php echo $min_attr; ?>
207 + <?php echo $dob_attr; ?>
162 208 <?php echo $required_attr; ?>
163 209 value="<?php echo esc_attr($prefill_value); ?>"
164 210 >
165 211 <?php
@@ -165,18 +211,81 @@
165 211 <?php
166 212 break;
167 213
168 214 default: // text, email, tel, number
169 - ?>
170 - <input
171 - type="<?php echo esc_attr($field['type']); ?>"
172 - id="<?php echo $field_id; ?>"
173 - name="<?php echo $field_name; ?>"
174 - placeholder="<?php echo esc_attr($field['placeholder'] ?? ''); ?>"
175 - <?php echo $required_attr; ?>
176 - value="<?php echo esc_attr($prefill_value); ?>"
177 - >
178 - <?php
215 + // Phone (tel) fields get the international country-code widget
216 + // UNLESS it has been explicitly disabled in the (Pro) form
217 + // builder. A missing key means ON, so every existing form and
218 + // customized field keeps the widget without needing a re-save.
219 + $is_phone_widget = (($field['type'] ?? '') === 'tel')
220 + && (!array_key_exists('show_country_code', $field) || !empty($field['show_country_code']));
221 +
222 + if ($is_phone_widget) {
223 + // Split the stored value for display: an international value
224 + // ("+9779806015400") is parsed into country + national part;
225 + // a legacy bare number is left in the number box under the
226 + // default country (never rewritten on display).
227 + $pv = (string) $prefill_value;
228 + $detected = \Yatra\Helpers\FormatHelper::detectPhoneCountry($pv);
229 + if ($detected !== null) {
230 + $p_iso = $detected['iso'];
231 + $p_dial = $detected['dial'];
232 + $p_national = $detected['national'];
233 + } else {
234 + $p_iso = \Yatra\Helpers\FormatHelper::getDefaultPhoneCountry();
235 + $p_dial = \Yatra\Helpers\FormatHelper::getDialingCode($p_iso);
236 + $p_national = $pv;
237 + }
238 +
239 + // Companion hidden field holding the chosen ISO. Array-style
240 + // names (travelers[0][phone]) become travelers[0][phone_country];
241 + // the server combines dial code + national number on submit.
242 + if (preg_match('/^(.*)\[([^\]]+)\]$/', $field_name, $mm)) {
243 + $companion_name = $mm[1] . '[' . $mm[2] . '_country]';
244 + } else {
245 + $companion_name = $field_name . '_country';
246 + }
247 +
248 + $flag_base = \defined('YATRA_PLUGIN_URL') ? YATRA_PLUGIN_URL . 'assets/img/flags/' : '';
249 + ?>
250 + <div class="yatra-phone-field" data-yatra-phone
251 + data-default-iso="<?php echo esc_attr($p_iso); ?>"
252 + data-flag-base="<?php echo esc_url($flag_base); ?>">
253 + <button type="button" class="yatra-phone-country" aria-haspopup="listbox" aria-expanded="false"
254 + aria-label="<?php esc_attr_e('Select country dialing code', 'yatra'); ?>">
255 + <img class="yatra-phone-flag" src="<?php echo esc_url($flag_base . strtolower($p_iso) . '.svg'); ?>"
256 + alt="" width="22" height="16" loading="lazy">
257 + <span class="yatra-phone-dial">+<?php echo esc_html($p_dial); ?></span>
258 + <span class="yatra-phone-caret" aria-hidden="true"></span>
259 + </button>
260 + <input
261 + type="tel"
262 + class="yatra-phone-number"
263 + id="<?php echo $field_id; ?>"
264 + name="<?php echo $field_name; ?>"
265 + value="<?php echo esc_attr($p_national); ?>"
266 + placeholder="<?php echo esc_attr(yatra_translate_form_string($field['placeholder'] ?? '')); ?>"
267 + inputmode="tel"
268 + autocomplete="tel-national"
269 + <?php echo $required_attr; ?>
270 + >
271 + <input type="hidden" class="yatra-phone-iso"
272 + name="<?php echo esc_attr($companion_name); ?>"
273 + value="<?php echo esc_attr($p_iso); ?>">
274 + </div>
275 + <?php
276 + } else {
277 + ?>
278 + <input
279 + type="<?php echo esc_attr($field['type']); ?>"
280 + id="<?php echo $field_id; ?>"
281 + name="<?php echo $field_name; ?>"
282 + placeholder="<?php echo esc_attr(yatra_translate_form_string($field['placeholder'] ?? '')); ?>"
283 + <?php echo $required_attr; ?>
284 + value="<?php echo esc_attr($prefill_value); ?>"
285 + >
286 + <?php
287 + }
179 288 break;
180 289 }
181 290 ?>
182 291 </div>
@@ -214,11 +323,11 @@
214 323 }
215 324 }
216 325 ?>
217 326 <div class="yatra-booking-section">
218 - <h2 class="yatra-section-title"><?php echo esc_html($section_config['title'] ?? ''); ?></h2>
327 + <h2 class="yatra-section-title"><?php echo esc_html(yatra_translate_form_string($section_config['title'] ?? '')); ?></h2>
219 328 <?php if (!empty($section_config['description'])) : ?>
220 - <p class="yatra-section-description"><?php echo esc_html($section_config['description']); ?></p>
329 + <p class="yatra-section-description"><?php echo esc_html(yatra_translate_form_string($section_config['description'])); ?></p>
221 330 <?php endif; ?>
222 331
223 332 <?php foreach ($grouped_fields as $section_key => $section_fields) : ?>
224 333 <?php if ($section_key !== 'main') : ?>
@@ -396,9 +505,13 @@
396 505 $category_id = $pt->category_id ?? $index;
397 506 $category_label = $pt->category_label ?? __('Traveler', 'yatra');
398 507 $category_price = isset($pt->effective_price) ? (float) $pt->effective_price : ($pt->sale_price ?? $pt->discounted_price ?? $pt->original_price ?? 0);
399 508 $count = isset($traveler_counts[$category_id]) ? (int) $traveler_counts[$category_id] : ($index === 0 ? 1 : 0);
400 - $subtotal = $category_price * $count;
509 + // Single source of truth for the line amount (per-person × count, flat
510 + // per-group, or per-block group pricing). Defaults to the prior flat/
511 + // multiply behaviour when group_overflow is absent.
512 + $pt_pricing_mode = $pt->pricing_mode ?? 'per_person';
513 + $subtotal = \Yatra\Services\TripPricingService::categoryLineSubtotal($pt, $count, $category_price);
401 514
402 515 $age_info = '';
403 516 if (isset($pt->age_min) || isset($pt->age_max)) {
404 517 if (isset($pt->age_min) && isset($pt->age_max)) {
@@ -418,8 +531,9 @@
418 531 'category_label' => $category_label,
419 532 'category_price' => $category_price,
420 533 'count' => $count,
421 534 'subtotal' => $subtotal,
535 + 'pricing_mode' => $pt_pricing_mode,
422 536 'age_info' => $age_info,
423 537 ];
424 538
425 539 $calculated_total += $subtotal;
@@ -445,13 +559,19 @@
445 559 $initial_due_amount = $initial_total_amount;
446 560
447 561 ?>
448 562
449 -<?php if (!empty($traveler_config) && !$is_remaining_payment) : ?>
563 +<?php
564 +// Honour the Traveler section's enable flag (Pro Dynamic Form module), mirroring
565 +// the Contact/Emergency sections. The default config has no `enabled` key, so an
566 +// un-customised/Free site treats the section as enabled and renders as before.
567 +$traveler_section_enabled = !isset($traveler_config['enabled']) || (bool) $traveler_config['enabled'];
568 +?>
569 +<?php if (!empty($traveler_config) && $traveler_section_enabled && !$is_remaining_payment) : ?>
450 570 <div class="yatra-booking-section">
451 - <h2 class="yatra-section-title"><?php echo esc_html($traveler_config['title'] ?? __('Traveler Information', 'yatra')); ?></h2>
571 + <h2 class="yatra-section-title"><?php echo esc_html(yatra_translate_form_string($traveler_config['title'] ?? '') ?: __('Traveler Information', 'yatra')); ?></h2>
452 572 <?php if (!empty($traveler_config['description'])) : ?>
453 - <p class="yatra-section-description"><?php echo esc_html($traveler_config['description']); ?></p>
573 + <p class="yatra-section-description"><?php echo esc_html(yatra_translate_form_string($traveler_config['description'])); ?></p>
454 574 <?php endif; ?>
455 575
456 576 <div id="yatra-travelers-container">
457 577 <?php
@@ -486,8 +606,22 @@
486 606 } else {
487 607 /* translators: %d: traveler sequence number. */
488 608 $traveler_label = ($i === 1) ? __('Traveler 1 (Lead Traveler)', 'yatra') : sprintf(__('Traveler %d', 'yatra'), $i);
489 609 }
610 +
611 + // Fields targeted at the lead traveler (applies_to === 'lead') render
612 + // only for Traveler 1; everything else ('all' / unset) renders for
613 + // every traveler. Empty subsections are dropped so additional
614 + // travelers don't get an orphan heading.
615 + $traveler_grouped_fields = [];
616 + foreach ($grouped_traveler_fields as $sk => $sf) {
617 + $applicable = array_values(array_filter($sf, function ($f) use ($i) {
618 + return ($f['applies_to'] ?? 'all') !== 'lead' || $i === 1;
619 + }));
620 + if (!empty($applicable)) {
621 + $traveler_grouped_fields[$sk] = $applicable;
622 + }
623 + }
490 624 ?>
491 625 <div class="yatra-traveler-form" data-traveler-index="<?php echo esc_attr($i); ?>" <?php if (!empty($traveler_category_map[$i])): ?>data-category-id="<?php echo esc_attr($traveler_category_map[$i]['category_id']); ?>" data-category-label="<?php echo esc_attr($traveler_category_map[$i]['category_label']); ?>"<?php endif; ?>>
492 626 <div class="yatra-traveler-header">
493 627 <h3 class="yatra-traveler-title"><?php echo esc_html($traveler_label); ?></h3>
@@ -495,9 +629,9 @@
495 629 <span class="yatra-traveler-note"><?php esc_html_e('Additional traveler', 'yatra'); ?></span>
496 630 <?php endif; ?>
497 631 </div>
498 632
499 - <?php foreach ($grouped_traveler_fields as $section_key => $section_fields) : ?>
633 + <?php foreach ($traveler_grouped_fields as $section_key => $section_fields) : ?>
500 634 <?php if ($section_key !== 'main') : ?>
501 635 <div class="yatra-traveler-subsection">
502 636 <h4 class="yatra-subsection-title">
503 637 <?php
@@ -556,8 +690,11 @@
556 690 'deposit_required' => $deposit_required,
557 691 'deposit_percentage' => $deposit_percentage,
558 692 'partial_payment' => $partial_payment,
559 693 'partial_payment_percentage' => $partial_payment_percentage,
694 + // Tour start (when a date is already chosen) → Pro hides deposit/partial for
695 + // tour-anchored payments when the tour is inside the balance-due window.
696 + 'travel_date' => isset($booking->travel_date) ? (string) $booking->travel_date : '',
560 697 ]);
561 698
562 699 $has_flexible_options = $flexible_payments_enabled && !empty($payment_method_options);
563 700 ?>
@@ -652,20 +789,28 @@
652 789 </div>
653 790 <?php endif; ?>
654 791
655 792 <!-- Account Creation Section (only for guests) -->
656 -<?php
793 +<?php
657 794 $allow_guest_checkout = \Yatra\Services\SettingsService::isEnabled('allow_guest_checkout');
658 795 $require_login = \Yatra\Services\SettingsService::isEnabled('require_login');
796 +// Account CREATION is gated by the same setting the backend enforces
797 +// (AuthController rejects registration when this is off). When registration is
798 +// disabled we never offer account-creation UI.
799 +$registration_enabled = \Yatra\Services\SettingsService::isEnabled('customer_registration');
659 800
660 -// Show account section if user is not logged in
661 -if (!is_user_logged_in() && !$is_remaining_payment) :
801 +// Show the account section only when it has something to render: login is
802 +// required, guest checkout is off (must authenticate), or registration is on
803 +// (optional/required account creation). When registration is OFF and guests are
804 +// allowed, there is nothing to show — proceed as a pure guest.
805 +if (!is_user_logged_in() && !$is_remaining_payment
806 + && ($require_login || !$allow_guest_checkout || $registration_enabled)) :
662 807 ?>
663 808 <div class="yatra-booking-section yatra-account-section">
664 809 <h2 class="yatra-section-title"><?php esc_html_e('Account', 'yatra'); ?></h2>
665 810
666 - <?php if ($require_login) : ?>
667 - <!-- Login Required Message -->
811 + <?php if ($require_login || (!$allow_guest_checkout && !$registration_enabled)) : ?>
812 + <!-- Login Required Message (login required, OR guests off with registration disabled) -->
668 813 <div class="yatra-login-required-notice" style="background: #fef3c7; border: 1px solid #f59e0b; padding: 16px; border-radius: 8px; margin-bottom: 16px;">
669 814 <div style="display: flex; align-items: flex-start; gap: 12px;">
670 815 <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#d97706" stroke-width="2" style="flex-shrink: 0;">
671 816 <circle cx="12" cy="12" r="10"></circle>
@@ -674,9 +819,11 @@
674 819 </svg>
675 820 <div>
676 821 <p style="font-weight: 600; color: #92400e; margin: 0 0 8px 0;"><?php esc_html_e('Login Required', 'yatra'); ?></p>
677 822 <p style="color: #a16207; margin: 0 0 12px 0; font-size: 14px;">
678 - <?php esc_html_e('You must be logged in to complete this booking. Please log in or create an account.', 'yatra'); ?>
823 + <?php echo $registration_enabled
824 + ? esc_html__('You must be logged in to complete this booking. Please log in or create an account.', 'yatra')
825 + : esc_html__('You must be logged in to complete this booking. Please log in to continue.', 'yatra'); ?>
679 826 </p>
680 827 <a href="<?php echo esc_url(wp_login_url(get_permalink())); ?>" class="yatra-login-btn" style="display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; background: #3b82f6; color: #fff; text-decoration: none; border-radius: 6px; font-weight: 500; font-size: 14px;">
681 828 <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
682 829 <path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"></path>
@@ -684,19 +831,21 @@
684 831 <line x1="15" y1="12" x2="3" y2="12"></line>
685 832 </svg>
686 833 <?php esc_html_e('Log In', 'yatra'); ?>
687 834 </a>
835 + <?php if ($registration_enabled) : ?>
688 836 <span style="margin: 0 12px; color: #a16207;"><?php esc_html_e('or', 'yatra'); ?></span>
689 837 <a href="<?php echo esc_url(wp_registration_url()); ?>" style="color: #3b82f6; text-decoration: none; font-weight: 500;">
690 838 <?php esc_html_e('Create an Account', 'yatra'); ?>
691 839 </a>
840 + <?php endif; ?>
692 841 </div>
693 842 </div>
694 843 </div>
695 844 <input type="hidden" name="login_required" value="1">
696 845
697 - <?php elseif (!$allow_guest_checkout) : ?>
698 - <!-- Account Required - Must Create Account -->
846 + <?php elseif (!$allow_guest_checkout && $registration_enabled) : ?>
847 + <!-- Account Required - Must Create Account (registration enabled) -->
699 848 <p class="yatra-section-description" style="margin-bottom: 16px;">
700 849 <?php esc_html_e('Please create an account to complete your booking. This allows you to manage your bookings and receive important updates.', 'yatra'); ?>
701 850 </p>
702 851
@@ -725,10 +874,10 @@
725 874 <?php esc_html_e('Your email address will be used as your username.', 'yatra'); ?>
726 875 </p>
727 876 <input type="hidden" name="create_account" value="1">
728 877
729 - <?php else : ?>
730 - <!-- Guest Checkout Allowed - Optional Account Creation -->
878 + <?php elseif ($registration_enabled) : ?>
879 + <!-- Guest Checkout Allowed - Optional Account Creation (registration enabled) -->
731 880 <p class="yatra-section-description" style="margin-bottom: 16px;">
732 881 <?php esc_html_e('Create an account to easily manage your bookings and receive travel updates.', 'yatra'); ?>
733 882 </p>
734 883
@@ -743,8 +892,9 @@
743 892 <label for="account_password">
744 893 <?php esc_html_e('Password', 'yatra'); ?> <span class="required">*</span>
745 894 </label>
746 895 <input type="password" id="account_password" name="account_password" minlength="8"
896 + autocomplete="new-password"
747 897 placeholder="<?php esc_attr_e('Minimum 8 characters', 'yatra'); ?>">
748 898 </div>
749 899 <div class="yatra-form-group yatra-field-half">
750 900 <label for="account_password_confirm">
@@ -750,8 +900,9 @@
750 900 <label for="account_password_confirm">
751 901 <?php esc_html_e('Confirm Password', 'yatra'); ?> <span class="required">*</span>
752 902 </label>
753 903 <input type="password" id="account_password_confirm" name="account_password_confirm" minlength="8"
904 + autocomplete="new-password"
754 905 placeholder="<?php esc_attr_e('Re-enter password', 'yatra'); ?>">
755 906 </div>
756 907 </div>
757 908 <p class="yatra-field-hint" style="font-size: 13px; color: #6b7280; margin-top: 8px;">
@@ -764,9 +915,9 @@
764 915 </p>
765 916 </div>
766 917 <?php endif; ?>
767 918 </div>
768 -<?php elseif (!is_user_logged_in()) : ?>
919 +<?php elseif (is_user_logged_in()) : ?>
769 920 <!-- User is logged in -->
770 921 <div class="yatra-booking-section yatra-logged-in-notice">
771 922 <div style="display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #ecfdf5; border: 1px solid #10b981; border-radius: 8px;">
772 923 <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#059669" stroke-width="2">