Hiding product price, tax included, and quantity on specific product pages

Solved
zackbaseball
New Member
2 0 1

I'm looking for a way to adjust my product-template.liquid code to hide the product price, the tax included text, and the quantity on any product pages that are tagged with Product Type "Auction".

This is using the Debut theme. Any suggestions would be much appreciated. Thanks!

 

Product Page Info.JPG

Accepted Solution (1)

Accepted Solutions
malalta
Shopify Partner
23 5 8

This is an accepted solution.

You can get a list of tags on your product with {{ product.tags }} (docs)

...and you can check if a particular tag exists in that list with the "contains" operator (docs).

...and you can wrap the items you want to hide in an {% unless %} tag (docs) that will only render its content if the condition you give it is not true.

Putting it together, the following is the same as saying "render this content only if my product does not contain the auction tag":

{% unless product.tags contains "auction" %}
  <div class="product-single__quantity">
    <!-- ...code for quantity selector... -->
  </div>
{% endunless %}

 You could then do something similar for the other items you want to hide.

Hope that helps!
Andrew.

View solution in original post

Replies 4 (4)
malalta
Shopify Partner
23 5 8

This is an accepted solution.

You can get a list of tags on your product with {{ product.tags }} (docs)

...and you can check if a particular tag exists in that list with the "contains" operator (docs).

...and you can wrap the items you want to hide in an {% unless %} tag (docs) that will only render its content if the condition you give it is not true.

Putting it together, the following is the same as saying "render this content only if my product does not contain the auction tag":

{% unless product.tags contains "auction" %}
  <div class="product-single__quantity">
    <!-- ...code for quantity selector... -->
  </div>
{% endunless %}

 You could then do something similar for the other items you want to hide.

Hope that helps!
Andrew.

View solution in original post

zackbaseball
New Member
2 0 1

Simple solution and it worked like a charm for everything I needed to hide.

Thank you from this coding newbie, Andrew!

robertjohn17
Excursionist
17 0 5

where does this above code go? I want to remove pricing on certain products throughout the store and this seems the way to do it

 

robertjohn17
Excursionist
17 0 5

i have edited my product-template.liquid to what you showed above but it doesn't seem to be doing anything to my products

 

codecode