Hiding Prices on Sold Out items...?

New Member
2 0 0

I want to keep sold items on my site for a little while (as everything I am making is one-of-a-kind), but I would like for the price to not be visible for any items that have been sold.  I can go in and remove the price, but the default is $0.00 which is not what I want.

Any suggestions?  (I'm using Mr Parker theme)

0 Likes
Shopify Expert
2674 65 664

Hi Jen,

In collection listing you can hide the price of sold products by adding this rule to the bottom of the stylesheet.css Asset:

.so.icn ~ .product-info .price {
    display: none;
}

It hides the price for products which have Sold Out badge (element with classes .so.icn).

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
1 Like
New Member
2 0 0

Yay! It works!  ?

thank you so much for your help!

0 Likes
New Member
5 0 0

Hi! 

I would like to do the same - hide the prices of sold out items in collections. I am using Fashionopolism and the above code doesn't work for my theme. If anyone can help me that would be greatly appreciated. Thank you!

Jamie

0 Likes
Shopify Expert
2674 65 664

Jamie,

unfortunately, the structure of your HTML does not allow to do it in such a "hack-ish" way.

If your version of the theme is similar to the one I have, you can open the product-listing.liquid Snippet, find this code:

    <div class="price">
      {% if product.price < product.compare_at_price %}
      <div class="onsale">{{ product.price | money }}</div>
      <div class="was">{{ product.compare_at_price | money }}</div>
      {% else %}
      <div class="prod-price"> . . . .</div>
      {% endif %}	
    </div>

and wrap it with conditional, like so:

{% if product.available %}
    <div class="price">
     . . . .
    </div>
{% endif %}

I've replaced some code with dots for clarity, you should keep it in place.

AND!, do not forget to create a backup copy of the theme before doing your edits via Actions => Duplicate.

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
0 Likes
New Member
5 0 0

It worked! Thank you so much, Tim!

 

0 Likes
Shopify Expert
2674 65 664

You're quick :)

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
0 Likes
New Member
5 0 0

Hi Tim, I wonder if you could help me with a follow-on question? The prices of sold-out items are now hidden when I view the collections, but when I search for a sold-out product specifically, the price still shows in the search result. Where do I go to fix that? Thank you in advance.

Jamie

0 Likes
Shopify Expert
2674 65 664

Hmm, they've decided to not use this snippet in search results -- go to search-template.liquid Section, find this code

          {% if item.object_type == 'product' %}
            <div class="price">

and change it to:

          {% if item.object_type == 'product' and item.available %}
            <div class="price">

 

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
0 Likes
New Member
5 0 0

It worked! Thank you! You're a life saver :)

0 Likes