title: How do I hide unavailable variants in search results in Shopify? (Debut theme)
body: <p>When I search for products, the result shows that a product is sold out when the first variant (option from the product dropdown) is sold out even though other variants are available.</p>
  <p>For example, if a product has colours red &amp; blue (red being the first option), once the red is sold out, the product shows &quot;sold out&quot; in the search result. Only when you click it then you'll see the blue colour is available.</p>
  <p>I tried adding a conditional in my search.liquid file, just after looping through the search results before rendering the results, to check if the item is available.</p>
  <pre><code>{% for item in search.results %}
  {% if item.object_type == 'product' and item.available == true %}
  // then rendered the products...
  </code></pre>
  <p>But what that does is hide products that have all the variants (options) sold out.</p>
  <p>I can also hide variants that are sold out (like a particular colour or size of a product for example) on the product details page so it doesn't even show up as an option.</p>
  <p>But the challenge is with the search results. It still shows sold out for any product that the first option is unavailable. Any help, please?</p>