How to hide price and Buy button for non b2b user for a specific collection

Topic summary

Goal: Hide price and Buy button for products in one specific collection from most visitors (non‑B2B), while logged‑in B2B customers can see them. Products are tagged by product type (B2B vs B2C).

Initial approach: Edit the product.liquid/product-template.liquid to check if a customer is logged in; if yes, show price and Buy button; if not, replace with a “Contact us for pricing” message for B2C products.

Clarification: OP needs this restriction only for a single collection, not all products.

Updated suggestion: Keep the logged‑in check, and add conditions to apply the hide/show only when the product type is B2C and the product belongs to a specified collection (by its handle). The non‑logged‑in view shows a “Contact us for pricing” message for that collection’s B2C products; logged‑in customers see normal pricing and purchase options.

Status: A revised code snippet was provided; OP has not confirmed success. No final resolution yet; implementation depends on theme templates and correct collection handle usage.

Summarized with AI on January 8. AI used: gpt-5.

Greetings, I have only one collection of products that are only for professionals and so I want to hide the price and the Buy button of those products but only for the 99% of the people, the b2b customers can normally see the price and Buy button when they are logged in. I have set those products with a product type of “B2B” and the rest of the products have a product type of “B2C” if this helps.

Thanks in advance

Hey @mpatsia ,

I am not sure about your theme but you can try this.

Open the product.liquid or product-template.liquid file in your theme, and add the following code:

{% if customer %}
  {% comment %} Customer is logged in, show price and buy button {% endcomment %}
  {{ content_for_header }}
{% else %}
  {% comment %} Customer is not logged in, hide price and buy button for B2C products {% endcomment %}
  {% if product.type == 'B2C' %}
    

Contact us for pricing

  {% endif %}
{% endif %}

Thanks

1 Like

Hello Azamgill and thanks for the replay. This will hide the product price for all products but I have those products inside one only collection that I want to hide it.

Please try this.

{% if customer %}
  {% comment %} Customer is logged in, show price and buy button {% endcomment %}
  {{ content_for_header }}
{% else %}
  {% comment %} Customer is not logged in, hide price and buy button for B2C products {% endcomment %}
  {% if product.type == 'B2C' and product.collections contains 'YourSpecificCollectionHandle' %}
    

Contact us for pricing

  {% endif %}
{% endif %}
1 Like