How can I hide wholesale product prices in search results?

I have a separate set of products on my store that are tagged with ‘wholesale’ that require a user to be logged in and also be tagged with ‘wholesale’ to access. problem is anyone searching can see the prices of all products!

Pretty sure its debut theme - where do I check this? I have tried adding a line (red) in search.liquid to hide all products tagged with ‘wholesale’ but this does not work…

{% for item in search.results %}
{% unless item.tags contains ‘wholesale’ %}

Any suggestions as to why it would not be working?

Failing that I want to just remove the prices from all the search results - can this be done?

cheers for any help,

JD

search.liquid

{% paginate search.results by 10 %}

{% if search.performed == false %}

{{ 'general.search.title' | t }}

{% else %}

{{ 'general.search.heading' | t: count: search.results_count }}: {{ 'general.search.results_with_count' | t: terms: search.terms, count: search.results_count }}

{% endif %}
  • {{ 'general.search.empty_search_message' | t }}
{{ 'general.search.submit' | t }}

{% if search.performed and search.results_count == 0 %}


{{ 'general.search.no_results_html' | t: terms: search.terms }}

{% endif %}

{% if search.performed %}
{% if search.results_count > 0 %}


{% endif %}

{{ 'general.search.heading' | t: count: search.results_count }}

    {% for item in search.results %} {% unless item.tags contains 'wholesale' %}
  • {% if item.object_type == 'product' %} {% include 'product-card-list', product: item %} {% else %}
    {{ item.title }}
    {% if item.image %}
    {{ item.image.alt | escape }}
    {% endif %}
    {{ item.title }}
    {% if item.published_at %}{{ item.published_at | date: "%b %d, %Y" }} — {% endif %} {{ item.content | strip_html | truncate: 200 }}
    {% endif %}
  • {% endunless %} {% endfor %}

{% if paginate.pages > 1 %}
{% include ‘pagination’ %}
{% endif %}
{% endif %}

{% endpaginate %}

Crickets… any shopify help for this one please?

Did anyone help on this? I’m having the exact same issue.

Did you manage to resolve this question?

Iam in serious need of assistance on this one. everything works well in the wholesale section but when searching wholesale in the search field anyone can see these prices.

please help

This is how I managed to successfully prevent the price from showing up in search:

To prevent this the following code was added to search.liquid :

{% if customer.has_account == true %}

……….

{% endif %}

Inserted as follows:

![Picture1.png|716x408](upload://iGtyRomtIDnRoGrb41JdhorZHz6.png)

Followed at the end by:

1 Like

Just to add more information. My above post works as the customer has to have an account to access the site. I have mine setup so the public can not view prices unless they have an account.

1 Like

This worked thank you so so much!!

Thx for the above. What about hiding prices in the search results regardless of account status? In my case the product listings do not have a set price so just want to display the title.

thx!

Rob