Hello!
I’m looking for a way in the Simple theme to hide the price when a product is sold out, on the product page as well as for a specific collection.
Any help would be greatly appreciated! Thank you!
Hello!
I’m looking for a way in the Simple theme to hide the price when a product is sold out, on the product page as well as for a specific collection.
Any help would be greatly appreciated! Thank you!
Sorry for facing this issue, it’s my pleasure to help us.
Welcome to the Shopify community!
and Thanks for your Good question.
Please share your site URL,
So I will check and provide a solution here.
For your collections page, open product-grid-item.liquid in your snippets folder. Ctrl + F for “product__price” ← that’s with 2 underscores. It’s around line 73, wrap the price span in a condition checking if the product is available, to show the price {% if product.available %} {% endif %}
{% if product.available %}
{% if product.price_varies %}
{% assign price = product.price | money %}
{{ 'products.product.from_text_html' | t: price: price }}
{% else %}
{{ 'products.product.regular_price' | t }}
{{ product.price | money }}
{% endif %}
{% endif %}
For your product, open product-template.liquid in your sections folder. Ctrl + F and search for “product-single__prices”, and wrap that
element the same way:
{% if product.available %}
{% if product.compare_at_price_max > product.price %}
{{ 'products.product.sale_price' | t }}
{% else %}
{{ 'products.product.regular_price' | t }}
{% endif %}
{{ current_variant.price | money }}
{% if product.compare_at_price_max > product.price %}
{{ 'products.product.regular_price' | t }}
<s>
{{ current_variant.compare_at_price | money }}
</s>
{% endif %}
{% include 'product-unit-price', variant: current_variant, available: true %}
{% endif %}
Then just make sure that you are tracking inventory on the back end and that you don’t have “Continue Selling when Out of Stock” checked.
Thanks a lot, it works!