# Booking form

You will use the booking form shortcode or bloc to display a search/booking form. The reservation process has different steps and some redirection can be implemented at the following steps:

- **Search results:** once the guest has indicated his dates, number of guests and number of accommodation. This redirection can be implemented for global search only.
- **Customer/Reservations details form:** once the guest has selected the accommodation type.
- **Thank you and Summary:** at the last reservation step, once the confirmation screen is shown.

* * *

<a id="shortcode-hb_booking_form"></a>

## Shortcode \[hb\_booking\_form\]

Use the **\[hb\_booking\_form\]** shortcode to display a booking form on your website.

<a id="parameters-for-the-search-type"></a>

### Parameters for the search type

With HBook, you can either have a **global search** (search for all accommodation types) or a **specific search** (for one type of accommodation only).  

**Default behavior:**

- Within an accommodation type page, be it an HBook **Accommodation Type** or on the page set as [Display option](../../hbook-documentation/accommodation-types.md#display-options), the search is specific to this accommodation type, by default.
- Within any other page, the search is by default global, for all accommodation types.

**Parameters:**

- **all\_accom:** when displayed on an accommodation page, the search form will only look for that accommodation. If you want the search form to look for all accommodation, set the **all\_accom** parameter to **yes**.
- **accom\_id:** use this parameter to make the search form to only look for a specific accommodation type. You will find the accommodation ID in the accommodation type post right under the title.

<a id="parameters-for-the-redirection"></a>

### Parameters for the redirection

**Default behavior:**

- The booking process has various steps, and by default, there is no redirection.

**Parameters:**

- **search\_only:** use this parameter to display a search form only. Once they have clicked on the “Search” button, customers will be redirected to the page whose URL is entered in the **redirection\_url** parameter.

> [!INFO]
> This parameter can only be used in global searched, not when used on an accommodation page or with the “accom\_id”.

- **redirection\_url:** add this parameter if you use the **search\_only** parameter, or if you use the shortcode on an accommodation page. This parameter must contain the URL of your main booking page (this page will have a **\[hb\_booking\_form\]** shortcode).
- **thank\_you\_page\_url:** this parameter is useful if you wish to redirect the customer to a different page for the reservation confirmation screen, usually called “Thank you page”. On that “Thank you page”, you need to have a [\[hb\_reservation\_summary\] shortcode or a bloc “Reservation summary”](../shortcodes-blocks/reservation-summary.md).

> [!INFO]
> If you use the “redirection\_url” parameter, then you should include this parameter only in the booking form shortcode on the page to which your customer is redirected.

<a id="parameters-for-design-and-customization"></a>

### Parameters for design and customization

**Default behavior:**

- By default, HBook does not display the thumbnail and the description if there is only one accommodation type set, or if the search is for a specific accommodation type.

**Parameters:**

- **force\_display\_thumb:** add this parameter if you wish to display the accommodation thumbnail when the search is for a specific accommodation type. You can set this parameter to **yes,** and the thumbnail will be displayed.
- **force\_display\_desc:** add this parameter if you wish to display the **Description displayed in the search results** when the search is for a specific accommodation type. You can set this parameter to **yes,** and the description will be displayed.
- **search\_form\_placeholder:** this parameter is useful if you wish to override the general setting for using labels or placeholders for the search form. You can find the general setting in **HBook > Search Form**.
- **form\_id:** add this parameter to be able to **set the identifier** of the form to your desired ID. This can be useful if you wish for example to style differently one specific form or have specific JS interacting with this form.

**Examples**

> [!NOTE]
> **\[hb\_booking\_form search\_only="yes" redirection\_url="https://www.abc.com/main-booking-form"\]**  
> With this shortcode, your customer enters the check-in and check-out dates as well as the number of adults and children if requested. When he presses the “Search” button, he is redirected to another page for the next step of the booking (selection of accommodation and extra-services, customer details, payment, confirmation).

> [!NOTE]
> **\[hb\_booking\_form redirection\_url="https://www.abc.com/main-booking-form"\]**  
> With this shortcode, your customer enters the check-in and check-out dates as well as the number of adults and children if requested. The results of the search appear, and is it after having selected the accommodation type that he is redirected to another page. He will be able to select extra-services, enter customer details, etc.  
> You need to have a \[hb\_booking\_form\] shortcode on the page to which the customer is redirected.

> [!NOTE]
> **\[hb\_booking\_form thank\_you\_page\_url="https://www.abc.com/thank-you"\]**  
> With this shortcode, the customer is redirected to the “Thank you” page at the last step, where the reservation confirmation screen is displayed. On that “Thank you page”, you need to have a [\[hb\_reservation\_summary\] shortcode or a bloc](../shortcodes-blocks/reservation-summary.md) “Reservation summary”.

> [!NOTE]
> **\[hb\_booking\_form force\_display\_desc="yes" force\_display\_thumb="yes"\]**  
> With this shortcode, the thumbnail and description will be displayed even if the search is for only one accommodation type.

* * *

<a id="booking-form-block-gutenberg"></a>

## Booking form block - Gutenberg

![booking-gutenberg.png](./attachments/booking-gutenberg.png)

1. Select for which **accommodation type** the booking form is
2. Indicate if you wish to display a **Search only** booking form. With “Search only” parameter enabled, you need to indicate the **Redirection** page below. Your customer enter dates and number of guests searched. Once they have clicked on the “Search” button, they will be redirected to the page indicated in the parameter **Redirection** below. This parameter can only be used in global searched, not when used for a search for a specific accommodation type.
3. Indicate the **Redirection** page. You can use this combined with “Search only” parameter above enabled or disabled. When used alone, your customers will enter the dates and number of guests searched for, then select the accommodation. They will be redirected to the page indicated in this parameter to enter their customer details.
4. Indicate the **Thank you** page. You can use this parameter to redirect your customers to a specific page at the “Thank you” step, which is when the reservation confirmation screen is displayed, with the summary and the thanks messages.