hide prices of products in a collection?

Solved
You need to find the code in your collection.liquid file where it shows the
price and use an unless statement around it. So something like:



{% unless collection.handle == "your-collection-handle" %}

{{ product.price }}

{% endunless %}


This way it will show the price UNLESS it's the specified collection.


Dropshipcorporation.com We Help Shopify Dropshippers.We are Shopify Partner
Hit Like If My Reply Helpful
Click Accept as Solution If My Reply Answered Your Question.
0 Likes
Ninthony
Shopify Partner
1637 224 613

For supply theme open up your product-grid-item.liquid file in your snippets folder and look for this line and add an unless statement around it:

{% unless collection.handle == 'your-collection-handle' %}
    <div class="product-item--price">
      <span class="h1 medium--left">
        {% if on_sale %}
          <span class="visually-hidden">{{ "products.general.sale_price" | t }}</span>
        {% else %}
          <span class="visually-hidden">{{ "products.general.regular_price" | t }}</span>
        {% endif %}
        {% include 'price' with product.price %}
        {% if on_sale and section.settings.product_show_compare_at_price %}
          <small>
            <s>
              <span class="visually-hidden">{{ "products.general.regular_price" | t }}</span>
              {% include 'price' with product.compare_at_price %}
            </s>
          </small>
        {% endif %}
      </span>

      {%- if product.selected_or_first_available_variant.available and product.selected_or_first_available_variant.unit_price_measurement -%}
        {% include 'product-unit-price', variant: product.selected_or_first_available_variant %}
      {%- endif -%}
    </div>
    {% endunless %}

 

That will make it so your prices don't show on whatever collection you specify in the statement.

If my solution helped you, please like and accept as solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
0 Likes
sieber
Tourist
4 0 1

i found this code and I am pretty sure I did it exactly as you said, but the price is still visible

0 Likes
sieber
Tourist
4 0 1
i found this code and I am pretty sure I did it exactly as you said, but
the price is still visible
0 Likes
Ninthony
Shopify Partner
1637 224 613

Not much else I can say, make sure your collection handle is correct. I did it on my Supply theme and it worked out fine. If you want me to help you out just send me a DM with your store url and the name of the collection you want to hide and I'll request access to your store, duplicate your theme, and make the change for you.

If my solution helped you, please like and accept as solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
Romanwhite
New Member
3 0 0

Hi Ninthony, 

I added the code to theme.scss.liquid to remove product prices on collection pages and also commented out prices on product pages (created an alternate product template), since I have a single product store and price tiers are listed on the pricing page and Homepage as well. Google Ads suspended my adwords account for Circumventing systems policy, specifically Cloaking - which basically is redirecting users to a different URL and/or showing different content to google bot vs site visitors. I've checked all the URL redirects to make sure everything is in order. I believe it's the hidden product price, that's leading to the cloaking issue.

The only code change I made on product page is to hide (comment out) product prices and added the code above to remove prices from collection pages as well. Would really appreciate your thoughts on, if this could be considered as Cloaking ? - showing different content to the google bot (price is visible in the product page xml code) but is hidden from the users/site visitors. 

Would appreciate your thoughts on this. Thanks!

 

0 Likes
MamaHawkDraws
New Member
1 0 0

Hey @Ninthony Thank so much for all your help with this issue. I've been testing everything you've suggested and while this last piece of code worked for me in the desired collection, it gave me an error in another collection where I'd like to keep the pricing. Any thoughts on how to have pricing in one collection, but not another? TIA

0 Likes
Ninthony
Shopify Partner
1637 224 613

You just have to make a condition around the price using the collection handle:

{% unless collection.handle == "t-shirts" %}
  <div class="product-price">{{ product.price | money }}</div>
{% endunless %}

 

So in this instance the price would show up on every collection unless it was the T Shirt collection.

If my solution helped you, please like and accept as solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
Aroncheong
New Member
2 0 0

HI Ninthony, 

I like to request for your help to advise if there is a way to hide the prices if the product is marked as sold out in the inventory?

0 Likes
Ninthony
Shopify Partner
1637 224 613

Yup, you would have to make sure that the checkbox in the products admin "Track Quantity" is checked and "Continue Selling when Out of Stock" is not checked. Then you can add a condition around the price:

{% if product.available %}
  {{ product.price }}
{% endif %}

 

If my solution helped you, please like and accept as solution!
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D