Link Search Menu Expand Document

Package step product search

The package step product search tag executes a search on the given step’s listable products, and paginates the results. The results are PackageStepProducts. This automatically uses the step that the current page is loaded in the context of.

Input
{% package_step_product_search page_size: 3 %}
    {% for item in result.items %}
        <p>{{ item.product.name }}</p>
    {% endfor %}
    <div>
        {{ paginate.collection_size }} Results
        {{ paginate | default_pagination }}
    </div>
{% endpackage_step_product_search %}
Output
<p>Hotel option 1</p>
<p>Hotel option 2</p>
<p>Hotel option 3</p>
<p>Hotel option 4</p>
<div>
    112 Results
    <span class="prev">
    <a href="http://beyondadventures.com/pagination-test?page=2">Previous</a>
    </span>
    <span class="page">
    <a href="http://beyondadventures.com/pagination-test?page=1">1</a>
    </span>
    <span class="page">
    <a href="http://beyondadventures.com/pagination-test?page=2">2</a>
    </span>
    <span class="page current">3</span>
    <span class="page">
    <a href="http://beyondadventures.com/pagination-test?page=4">4</a>
    </span>
    <span class="page">
    <a href="http://beyondadventures.com/pagination-test?page=5">5</a>
    </span>
    <span class="deco">&hellip;</span>
    <span class="page">
    <a href="http://beyondadventures.com/pagination-test?page=9">9</a>
    </span>
    <span class="next">
    <a href="http://beyondadventures.com/pagination-test?page=4">Next</a>
    </span>
</div>

The tag returns an items array and a Paginate pagination object to the block passed in, the items array represents 1 page of the results from the search.

Tag-based filtering

If the company has added tags to the step’s products, these can be used to filter the results outputted by the search tag.

Product tags are textual values that identify attributes of the products. They are grouped under categories which the company is also able to define.

Some examples of these might be “Star Rating”, “Amenities”, “Distance” etc. Consult the company for the available tags and categories.

Syntax

package_step_product_search filters results if one or more search query parameters are present in the URL. The search query parameters are in the format search[<tag category>][]=<tag value>; add as many as needed to filter the results.

You can specify multiple categories and values by repeating the search[][] query parameter.

At the moment, filtering returns products that match at least one of the provided values in all of the filtered categories.

Examples

  • ?search[Star Rating][]=5 - Products with a 5 star rating only.
  • ?search[Star Rating][]=4&search[Star Rating][]=5 - Products with either a 4 star rating or a 5 star rating.
  • ?search[Amenities][]=Pool&search[Star Rating][]=5 - Products with a 5 star rating and pool access.
  • ?search[Amenities][]=Pool&search[Star Rating][]=5&search[Star Rating][]=4 - Products with pool access and either a 4 or 5 star rating.

Star rating filtering

Accommodation products that have a star rating set can be filtered using the search[star_rating][] query parameter. This filters on the product’s star rating attribute directly, rather than on tags.

The allowed star rating values are: 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5.

Syntax

Add one or more search[star_rating][]=<value> query parameters to the URL.

Products are included if their star rating matches any of the provided values. Products without a star rating (including non-accommodation products) are excluded when this filter is active.

Examples

  • ?search[star_rating][]=5 - Only products with a 5 star rating.
  • ?search[star_rating][]=3&search[star_rating][]=4.5 - Products with either a 3 or 4.5 star rating.
  • ?search[star_rating][]=4&search[Amenities][]=Pool - Can be combined with tag-based filtering. Products with a 4 star rating and pool access.

Occupancy filtering

Accommodation products can be filtered by guest occupancy using the search[occupancy][] query parameter. This filters products based on whether their variants can accommodate the specified number of guests.

Syntax

Add one or more search[occupancy][]=<number> query parameters to the URL, where <number> is the desired guest count (e.g., 1, 2, 4).

You can optionally specify a filtering mode using search[occupancy_match]=<mode>:

  • any (default if omitted) - Products must have at least one variant that can accommodate any of the specified occupancies
  • all - Products must have variants that can accommodate all specified occupancies

Products are included if at least one of their listable variants has a min_occupancy and max_occupancy range that includes the requested occupancy value. Non-accommodation products are not affected by this filter.

Examples

  • ?search[occupancy][]=2 - Products with variants that can accommodate 2 guests.
  • ?search[occupancy][]=2&search[occupancy][]=4 - Products with variants that can accommodate either 2 or 4 guests (OR mode).
  • ?search[occupancy][]=2&search[occupancy][]=6&search[occupancy_match]=all - Products that have variants accommodating both 2 and 6 guests (ALL mode).
  • ?search[occupancy][]=4&search[star_rating][]=5 - Can be combined with other filters. Products with 4-guest capacity and a 5 star rating.

Accessing occupancy params in Liquid

You can access the occupancy parameters in your Liquid templates using the search object:

{{ search["occupancy"] | join: ', ' }}
{{ search["occupancy_match"] }}

Or via page.params:

{{ page.params.search.occupancy | join: ', ' }}
{{ page.params.search.occupancy_match }}

To iterate over the occupancy array:

{% for occ in search["occupancy"] %}
  {{ occ }}{% unless forloop.last %}, {% endunless %}
{% endfor %}

End date filtering

Accommodation products can be filtered by end date using the search[end_date] query parameter. This filters products to only show those with at least one variant that is bookable between the package booking’s selected start date and the specified end date.

This filter only applies to accommodation steps and requires the package booking to have a selected start date.

Syntax

Add search[end_date]=<YYYY-MM-DD> as a query parameter to the URL, where the value is a date in YYYY-MM-DD format.

Examples

  • ?search[end_date]=2025-06-20 - Only accommodation products with availability between the booking’s start date and 20th June 2025.
  • ?search[end_date]=2025-06-20&search[occupancy][]=2 - Can be combined with other filters. Accommodation products available until 20th June 2025 that accommodate 2 guests.

Accessing end date params in Liquid

You can access the end date parameter in your Liquid templates using the search object:

{{ search["end_date"] }}

Or via page.params:

{{ page.params.search.end_date }}

Pagination

The results of this search are paginated for performance reasons. You can paginate results into equal page sizes, defining the number of results to display per page using the page_size attribute. There is a maximum page size of 100.

Additional parameters

exclude_sold_out_products

Accepts: true or false. This can be passed as a Liquid variable or explicitly.

Passing true will exclude step products if all its items are sold out. For some package/step configurations this will be limitted based on the package’s selected start date. E.g. for a multi-date package with required nights, we will check if the product has any available items for the required nights.

as a search tag attribute
{% package_step_product_search exclude_sold_out_products: true %}
{% endpackage_step_product_search %}