# Search URL parameters and the predictive search URL

> Every parameter the Shopify /search page accepts (q, type, options[prefix], options[unavailable_products], sort_by, page) and the /search/suggest.json endpoint.

Page: https://lintelagency.com/resources/shopify-tricks/search-url-parameters

## In short

Shopify’s /search page takes q plus optional parameters: type=product,page,article limits result types, options[unavailable_products]=show|hide|last places sold-out items, options[prefix]=last matches partial words in pages and articles, sort_by=price-ascending sorts and page paginates. Predictive search answers at /search/suggest.json?q=… with up to 10 results per type. Put the parameters in hidden form inputs to change how your theme’s search behaves.

## Facts

- **Search page:** /search?q=<terms>&type=product
- **Predictive:** /search/suggest.json?q=<terms>
- **Sort:** relevance, price-ascending, price-descending
- **Plan:** Every plan
- **Last checked:** 2 November 2026

## How to use it

1. Try the parameters directly: /search?q=snow&type=product&options[unavailable_products]=hide.
2. In the theme’s search form, add hidden inputs for type and the options you want; only q needs a visible field.
3. Use routes.search_url as the form action so multi-language stores keep the language.
4. For a dropdown as the customer types, call /search/suggest.json (or /search/suggest with section_id for HTML).

## Code

### search-form.liquid

```liquid
{%- comment -%}
  A products-only search form that hides sold-out products.
  routes.search_url keeps the market's language path (/fr/search).
  Only q needs user input; the rest are hidden inputs.
{%- endcomment -%}
<form action="{{ routes.search_url }}" role="search">
  <label for="SearchProducts">Search products</label>
  <input id="SearchProducts" type="search" name="q" value="{{ search.terms | escape }}">
  <input type="hidden" name="type" value="product">
  <input type="hidden" name="options[unavailable_products]" value="hide">
  <button type="submit">Search</button>
</form>
```

### urls.txt

```text
# Search page: /search with q and optional parameters
https://your-store.com/search?q=snow
https://your-store.com/search?q=snow&type=product
https://your-store.com/search?q=snow&type=product,page&options[unavailable_products]=hide&options[prefix]=last
https://your-store.com/search?q=snow&type=product&sort_by=price-ascending
https://your-store.com/search?q=snow&page=2

# Parameters
q                               the search terms (required)
type                            product, page, article (comma-separated; default all)
options[unavailable_products]   show | hide | last (default last)
options[prefix]                 last | none (pages and articles only; products match partial words anyway)
sort_by                         relevance | price-ascending | price-descending
page                            results page, default 1

# Predictive search (JSON), up to 10 results per type
https://your-store.com/search/suggest.json?q=bag&resources[type]=product,collection&resources[limit]=4

# Storefront filters work on search results too
https://your-store.com/search?q=snow&type=product&filter.v.availability=1
```

## Limits and edge cases

- Products match partial words automatically; options[prefix] only changes page and article results.
- Storefront search doesn’t support range queries like price:>50; use price filters (filter.v.price.gte) instead.
- Defaults for type and unavailable products can also be changed in the Search & Discovery app’s settings.
- Products hidden with the seo.hidden metafield or set to Unlisted don’t appear in search or predictive search.

## Questions

### How do I make Shopify search show only products?

Add type=product to the search URL, or a hidden input name="type" value="product" to the search form.

### How do I hide sold-out products in Shopify search?

Add options[unavailable_products]=hide, or set it as the default in the Search & Discovery app.

### What is the Shopify predictive search URL?

/search/suggest.json?q=<terms>, with resources[type] and resources[limit] to choose result types and count (1–10).

### Can I sort Shopify search results by price?

Yes: sort_by=price-ascending or price-descending. Non-product results move to the end.

## Shopify documentation

- [Storefront search](https://shopify.dev/docs/storefronts/themes/navigation-search/search)
- [Predictive Search API](https://shopify.dev/docs/api/ajax/reference/predictive-search)
- [Search query syntax (storefront notes)](https://shopify.dev/docs/api/usage/search-syntax)

## Related

- [Shopify Search Not Working? Check Predictive and Regular Search](https://lintelagency.com/journal/shopify-search-function-not-working)
- [Collection sort_by and filter URLs](https://lintelagency.com/resources/shopify-tricks/collection-sort-and-filter-urls)
- [Hide a product from search with seo.hidden](https://lintelagency.com/resources/shopify-tricks/hide-product-from-search)

License: MIT. Free to use in your own store and in client work.
