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
- In the WordPress admin, open the plugin settings.
- Navigate to the Test Drive configuration section.
- Enable the master toggle for test drive bookings.
- Configure available days, time window, slot duration, and any blackout dates (see Configuration reference below).
- 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
- Open any vehicle detail page.
- Scroll to the contact form section.
- Check the "Interested in a test drive?" checkbox.
- A date field and a time field appear below the checkbox.
- Select a date from the date input. Dates in the past are not selectable.
- 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.
- Select a time slot.
- Fill in the remaining contact form fields (name, email, message) as required.
- Submit the form.
The test drive request is included in the inquiry notification sent to the dealer.
Configuration reference
Test drive settings
| Setting | Option key | Default | Description |
|---|---|---|---|
| Master toggle | as24ci_test_drive_enabled | Off (0) | Enables or disables the test drive feature globally |
| Available days | as24ci_test_drive_available_days | Empty (all days) | ISO weekday numbers (1=Mon … 7=Sun) on which test drives are allowed |
| Slot start time | as24ci_test_drive_start_time | 08:00 | Earliest time slot in HH:MM 24-hour format |
| Slot end time | as24ci_test_drive_end_time | 18:00 | Latest time slot boundary in HH:MM 24-hour format |
| Slot duration | as24ci_test_drive_slot_duration | 30 (minutes) | Length of each time slot in minutes |
| Blackout dates | as24ci_test_drive_blackout_dates | Empty | Dates (Y-m-d format) on which no test drives are available, one per line |
Available days
Days are specified as ISO weekday numbers:
| Number | Day |
|---|---|
| 1 | Monday |
| 2 | Tuesday |
| 3 | Wednesday |
| 4 | Thursday |
| 5 | Friday |
| 6 | Saturday |
| 7 | Sunday |
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:
- The selected date's weekday must be in the configured available days list (or the list must be empty).
- The selected date must not be in the blackout dates list.
- 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 of08:00, end of18:00, and duration of30, slots are08:00,08:30,09:00, …17:30. - 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.
- 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-dformat (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_dateandtd_timefields correctly. Check for JavaScript errors in the browser console.