Link Search Menu Expand Document

Experience slot search

Experience slot search enables you to filter a Creator’s experiences with a separate result for each departure date of each experience.

The experience slot search is executed using the experience_slot_search tag. The tag returns an items array of ExperienceSlots, a paginate Pagination object, a search Search object, and an available_months array of Date objects (see Liquid documentation for Dates).

The experience slot search will only return public, published dates i.e. where the experience is published and has not been marked as private under ‘Manage product availability’ in the product settings.

{% experience_slot_search name: 'Beyond', duration: { greater_than: 3, less_than: 8 }, page_size: 12, sort: 'departure_date_asc' %}
  {% for item in result.items %}
    <p>{{ item.name }}</p>
  {% endfor %}
  <div>
    {{ paginate.collection_size }} Results
    {{ paginate | default_pagination }}
  </div>
{% endexperience_slot_search %}

It’s also possible to pass search parameters as query params, this is useful when building dynamic search pages.

http://beyondadventures.com/search?search[name]=beyond&search[departure_date][greater_than]=2021-11-22&search[sort]=departure_date_asc

Note: Parameters passed through query params will overwrite any of those specified as an attribute on the experience_slot_search tag.

Pagination

The results of the search are paginated to speed up page load, you can define the number of results displayed per page using the page_size parameter.

You can enable customers to move between the results pages using the paginate Pagination object. The default_pagination filter can be used to return a complete pagination UI.

You can assign the value of a Liquid variable to page_size.

Available Months

The experience slot search returns available_months, an array of Date objects, which can be used to construct the month and year filters for searching.

Each Date is dated 1st of the month, and there is one for each month in which a product’s slots start_on dates occur.

E.g. Today is 1st Jan 2024. You have a product with a 10 day duration, with the following slots (all future or ongoing);

  • 31th Dec 2023
  • 15th Jan 2024
  • 20th Jan 2024
  • 31th Jan 2024
  • 28th Feb 2024

The available_months will be Dates with the following dates:

  • 1st Dec 2023
  • 1st Jan 2024
  • 1st Feb 2024

You can use these to construct search filters, e.g.

input
{% experience_slot_search %}
  ...

  <select name="departure_month">
    {% for month in available_months %}
      <option value="{{ month | date: "%m" }}">
        {{ month | date: "%B" }}
      </option>
    {% endfor %}
  </select>
{% endexperience_slot_search %}
output
  <select name="departure_month">
    <option value="12">December</option>
    <option value="01">January</option>
    <option value="02">February</option>
  </select>

Parameters

Accessing query params

Once the search has been executed, it can be helpful to get a reference to the params and values in the search. For that, we can use the search Search object.

syntax
{{ search.departure_date }}

Sorting

Results can be sorted ascending or descending by name, departure date or duration using the sort parameter.

syntax
{% experience_slot_search sort: `departure_date_asc` %}
{% endexperience_slot_search %}