Ali Somay
Ali Somay

Reputation: 625

Is it possible to send an advanced query to Shopify /search url

I am customizing a Shopify template has a form like this.

      <form action="/search" method="get" class="search-bar" role="search">
        <input type="hidden" name="type" value="product">
        <input type="search" name="q" class="text" placeholder="{{ 'general.search.placeholder' | t }}" value="{{ search.terms }}">
        <input type="hidden" class="btn" value="Search">
      </form>

Which returns an array of objects search.results it is not possible to remove elements from that array in Liquid (ex. remove products which has a price of 0)

I want to remove elements from that array because even though i can filter those elements and choose them to show in the page or not, i cant effect {% paginate %} function because it is paginating the unfiltered version of search.results for example {% paginate search.results by 12 %}.

So my question is can i send an advanced query from the very start and only get the result for ex. products which have not a price of 0 ?

Thanks in advance. I googled about this a lot but couldn't find a solution.

`

Upvotes: 0

Views: 1414

Answers (1)

HymnZzy
HymnZzy

Reputation: 2925

Nope you can't. Price is not a valid field in Shopify's search fields - https://help.shopify.com/manual/sell-online/online-store/storefront-search

Alternatively you can tag the products with 0 price and add "-tag" as a field to exclude those items. Refer to the link for detailed description on search on Shopify.

Upvotes: 3

Related Questions