1. Home
  2. Docs
  3. Availability Search for WooCommerce Bookings
  4. Availability Search Shortcode

Availability Search Shortcode

Shortcode Parameters overview

Any of the parameters in the shortcode will be prioritised over the default settings.

Display the search[availability_search]
Select a date range[availability_search datepicker="range"]
Select a single date[availability_search datepicker="single"]
Allow customers to select categories[availability_search category_dropdown="true"]
Keyword Search – Flexible [availability_search keyword="flexible"]
Keyword Search – Strict [availability_search keyword="flexible"]
Limit Search to one category[availability_search category_include="your-category-slug"]
Limit Search to multiple categories (seperate with commas)[availability_search category_include="category-slug-one, category-2"]
Sub Categories in the dropdown[availability_search category_include="parent-slug" category_subcategory="true" ]
Put it all together[availability_search datepicker="range" category_dropdown="true" category_include="category-slug-one, category-2"]

Display a category dropdown

You can specify the category_dropdown parameters to be true. This will enable a dropdown selector that includes all of your product categories.

You can use the category dropdown together with the category_include parameter.

[availability_search category_dropdown="true"]

Limit Search by categories

This will only include the specific categories. Any product that’s not in the category will not show up in the search results.

Screenshot of the WooCommerce category slug setting

You’ll need your category slugs, which you can find under the WooCommerce product categories settings. Comma seperate the categories to include multiple categories.

[availability_search category_include="boat-tour, bus-tour"]

Category dropdown with specific categories

Limit the dropdown options by adding the category_include parameter with the slugs of your specific categories. You can find the slug under the WooCommerce product category settings.

You can also add multiple categories by using a comma separator.

[availability_search category_dropdown="true" category_include="accessories, bus-tour"]

Custom Category Ordering

Added in v1.6.4

Categories shown in the dropdown are ordered by your default WooCommerce category ordering in the admin menu. You can drag and drop them in the product category settings as needed.

If you’d like to override the default behaviour and sort categories alphabetically by name, then you can place the following into your shortcode category_order="name, ASC"

Available ordering methods:

DescriptionExample
Default sorting by WooCommerce Category order.Go to your Product categories to change this.
Alphabetically sorted by the category name.
category_order="name, ASC"
Sorted by the order you’ve written your categories inside category_include
category_order="include, ASC"
Ordered by the ID of categories.
category_order="id, ASC"

You can also replace ASC (ascending) with DESC (descending).

[availability_search category_dropdown="true" category_order="name, ASC"]

Sub Categories in the dropdown

[availability_search category_dropdown="true" category_include="parent, child" category_subcategory="true"]

You can mix parent categories and subcategories slugs inside the category_include include tag.

When category_subcategory="true" the category dropdown will display all subcategories of any parents categories.

Keyword Search

[availability_search keyword="flexible"]

You can add a keyword search along side the category selector by adding keyword="flexible” or keyword="strict" to the shortcode.

The keyword can either be flexible or strict
Let’s say we have two products named:

  1. The Great Fishing Trip
  2. The Great Charter Trip

Flexible: If you search “Great Fish” then both 1 & 2 will show up because both have the word “great”. Flexible requires at least one partial match. 

Strict: If you search “Great Fish” then only number 1 will show up, because strict requires each keyword (“great” & “fish”) to be a full or partial match in the product name. 

Was this article helpful to you? Yes No