Documentation · Frontend Guide

Test Drive Requests

This document covers the test drive booking feature of the ADP Car Market Hub WordPress Plugin: how it integrates with the contact form, how time slots are calculated, and how the feature is configured.

When to use this document

Read this document if you are setting up the test drive booking feature for the first time, configuring available days and time slots, or helping a visitor understand how to request a test drive.

Overview

The test drive feature extends the vehicle contact form on single vehicle detail pages with an optional test drive request. When enabled, the contact form includes a checkbox labeled "Interested in a test drive?" When a visitor checks it, date and time input fields appear. The visitor selects a date; available time slots for that date are loaded dynamically based on the configured schedule. The visitor then selects a time slot and submits the form. The test drive request is included in the inquiry email sent to the dealer.

No separate booking management system is included in the plugin. Test drive requests are delivered as part of the contact form email. Managing and confirming appointments is the dealer's responsibility outside the plugin.

Requirements or prerequisites

  • The test drive feature must be enabled in the plugin settings (TEST_DRIVE_ENABLED). It is disabled by default.
  • The contact form must be visible on the vehicle detail page. The contact form block must be active in the Layout Manager for the single vehicle page.
  • The WordPress site must be able to send email.
  • At least one available weekday and a valid time window must be configured for time slots to be generated.

Step-by-step instructions

Enable and configure the test drive feature

  1. In the WordPress admin, open the plugin settings.
  2. Navigate to the Test Drive configuration section.
  3. Enable the master toggle for test drive bookings.
  4. Configure available days, time window, slot duration, and any blackout dates (see Configuration reference below).
  5. Save the settings.

The test drive fields will appear automatically in the contact form on all published vehicle detail pages.

Visitor: request a test drive

  1. Open any vehicle detail page.
  2. Scroll to the contact form section.
  3. Check the "Interested in a test drive?" checkbox.
  4. A date field and a time field appear below the checkbox.
  5. Select a date from the date input. Dates in the past are not selectable.
  6. After a date is selected, the time dropdown is populated with available slots for that date. If the selected date is today, only future slots are shown. If there are no available slots (the day is not a configured working day, or all slots have passed for today, or the date is a blackout date), the time dropdown will show no selectable options.
  7. Select a time slot.
  8. Fill in the remaining contact form fields (name, email, message) as required.
  9. Submit the form.

The test drive request is included in the inquiry notification sent to the dealer.

Configuration reference

Test drive settings

SettingOption keyDefaultDescription
Master toggleas24ci_test_drive_enabledOff (0)Enables or disables the test drive feature globally
Available daysas24ci_test_drive_available_daysEmpty (all days)ISO weekday numbers (1=Mon … 7=Sun) on which test drives are allowed
Slot start timeas24ci_test_drive_start_time08:00Earliest time slot in HH:MM 24-hour format
Slot end timeas24ci_test_drive_end_time18:00Latest time slot boundary in HH:MM 24-hour format
Slot durationas24ci_test_drive_slot_duration30 (minutes)Length of each time slot in minutes
Blackout datesas24ci_test_drive_blackout_datesEmptyDates (Y-m-d format) on which no test drives are available, one per line

Available days

Days are specified as ISO weekday numbers:

NumberDay
1Monday
2Tuesday
3Wednesday
4Thursday
5Friday
6Saturday
7Sunday

If no days are configured (the setting is empty), all days are treated as available.

Time slot generation

The plugin calculates available time slots dynamically when a visitor selects a date. The rules applied are:

  1. The selected date's weekday must be in the configured available days list (or the list must be empty).
  2. The selected date must not be in the blackout dates list.
  3. Slots are generated from the start time to the end time in increments of the slot duration. The last slot starts at or before end_time − slot_duration. For example, with a start of 08:00, end of 18:00, and duration of 30, slots are 08:00, 08:30, 09:00, … 17:30.
  4. When the selected date is today (using the site's WordPress timezone), only slots whose start time is at or after the current time are returned.
  5. Dates in the past always return no available slots.

Contact form integration

The test drive section consists of:

  • A checkbox: "Interested in a test drive?"
  • A date input (type="date")
  • A time select dropdown (disabled until a date is selected; populated via JavaScript when the date changes)

The date and time values are submitted as hidden form fields (as24ci_contact[td_date] and as24ci_contact[td_time]) alongside the rest of the contact form data.

Operational notes

  • Time slot availability is calculated server-side and delivered to the browser via a REST or AJAX endpoint when the visitor selects a date. The plugin uses the WordPress site timezone (current_time()) for all time comparisons.
  • If the slot duration is configured as less than 1 minute, the plugin defaults to 30-minute slots.
  • If the start time equals or exceeds the end time in the configuration, no slots are generated for any date.
  • The test drive feature does not prevent double-bookings. Multiple visitors can request the same time slot. Appointment management is handled manually by the dealer.
  • Blackout dates can be entered as a newline-separated list or comma-separated list of dates in Y-m-d format (e.g. 2025-12-25). Invalid date entries are silently ignored.

Troubleshooting

The test drive checkbox does not appear on the contact form.

  • Verify the master toggle for test drive is enabled in the plugin settings.
  • Confirm the contact form block is enabled on the single vehicle page in the Layout Manager.

After selecting a date, the time dropdown shows no available slots.

  • Check that the selected date is a configured working day. If the available days setting is not empty, only listed days will have slots.
  • Check that the date is not in the blackout dates list.
  • If the selected date is today, all earlier slots are removed. If it is late in the day, there may be no remaining slots.
  • Verify the time window configuration: start time must be earlier than end time.

Test drive details do not appear in the dealer notification email.

  • The test drive date and time are included in the contact form submission. If they are missing from the notification email, verify that the contact form is submitting the td_date and td_time fields correctly. Check for JavaScript errors in the browser console.