Hiding specific product prices from search results

Hiding specific product prices from search results

DeNova
Shopify Partner
8 0 0

There are specific products on my site that are not yet for sale (and therefore do not have set prices). I currently have them listed as $999.99 on the backend and have hidden that price and all purchase options from the site. However, when you search for the product on the site, the price shows. Is there a way to hide prices in search results for only specific products?

 

I am using IMPACT theme and site url is: https://denovadetect.com/

 

Screen Shot 2024-07-16 at 11.46.39 AM.png

Reply 1 (1)

EcomGraduates
Shopify Partner
826 70 120

First, tag the products you want to hide the price for with hide-price. Then, edit your search results template to hide the price for those tagged products.

 

Find the search.liquid template or the section that renders search results.

 

{% for result in search.results %}
  {% if result.object_type == 'product' %}
    <div class="product-item">
      <h2>{{ result.title }}</h2>
      {% assign product = all_products[result.handle] %}
      {% unless product.tags contains 'hide-price' %}
        <p class="price">{{ result.price | money }}</p>
      {% endunless %}
    </div>
  {% endif %}
{% endfor %}

 

This checks if the product has the hide-price tag and hides the price if it does

hope this helps!


 If this fixed your issue, likes and accepting as a solution are highly appreciated
|  Build an online presence with our custom-built Shopify Theme: EcomifyTheme
|  Check out our reviews: Trustpilot Reviews
|  We are Shopify Partners: EcomGraduates Shopify Partner