WP Travel plugin includes a built-in checkout page that offers a smooth and complete booking experience for your customers.

This checkout page is created to gather all the essential information needed for the chosen trip, including travel details, billing information, and payment details.

One of the key features of the WP Travel plugin is the ability to collect information about multiple travelers during the booking process.

With the release of WP Travel v8.8.0 and WP Travel Pro v7.8.0, the plugin now includes a new hook that allows you to add a file upload option on the checkout page.

This new file upload feature gives customers the ability to upload any necessary documents or files as part of the booking process.

This can be particularly useful for trips that require specific documentation, such as passports, visas, or medical forms.

Learn more: Setting of booking option on the checkout page

To Add a File Upload Option to the Checkout Page

Following are the ways to add a file upload option to the checkout page:

Add the following code in the functions.php file

To add the file upload option on the checkout page, please add the following code in the functions.php file of your child theme or simply you can add it through code snippets.

add_filter( 'wptravel_checkout_enable_media_input', function(){ 
  return true; 
} );

For detailed information on creating a child theme, please refer to our KnowledgeBase.

After adding this filter code, you will see the “Upload Media” option on the checkout page, allowing your customers to upload any necessary documents or files as part of the booking process.

Note: This filter hook will not work for the On-Page booking along with the New User Interface (UI) of Stripe Checkout.

Use Filter Code to Change Label of File Upload Option

Furthermore, if you wish to change the label of the file upload option, you can do so using the following filter code:

add_filter( 'wptravel_checkout_media_input_label', function(){
 return __( 'You can add your text here' ); 
} );

This code will replace the default “Upload Media” label with your custom label on the checkout page.

Include the Uploaded File in the Email

Moreover, to include the uploaded file in the email, you will need to add the email tag in the email templates.

To do this, go to Admin Panel > WP Travel > Settings > Email > Email Templates and add the required column in the email template to include the email tag.

{media_attachment}

The file you have uploaded through the checkout page will be displayed in the email after you have added the email tag mentioned above.