All things Shopify and commerce
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' %}
<p>Contact us for pricing</p>
{% endif %}
{% endif %}
Thanks
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' %}
<p>Contact us for pricing</p>
{% endif %}
{% endif %}
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024