Show Prices On Frontend When Product Is Sold Out

Lloyd_Briones
Tourist
18 0 1

When a product is sold out in shopify, the price for it disappears on the front end and is replaced by "Sold Out". Is there a way to continue to display the price regardless of its zero inventory status?

Jami
Shopify Staff
Shopify Staff
209 1 26

Hi Lloyd,

Jamie here from Shopify. That certainly is customizable, and will be dependent on how it was set up by your theme designers. As a head up, I'm not a theme designer myself, but I took a peek at your theme and it looks like we can add {{ variant.price | money }} or {{ variant.compare_at_price | money }} to your product.liquid file on line 62 which could look something like this: 

<span class="sold_out">{% if variant.available == false %}{{ 'products.product.sold_out' | t }} - {{ variant.price | money }} {% endif %}</span>

You would find this in your admin > online store > themes > (...) > edit HTML/CSS > templates > product.liquid. There are lots of tweaks you can make to this section to appear as you would like. Often speaking with the theme developer directly is a good first step when looking to make changes to the HTML/CSS. 

I hope that gets you headed in the right direction! 

 

Lloyd_Briones
Tourist
18 0 1

Thanks! It sort of works - it shows the price for the specific product page, but it doesnt display the price for displayed gallery pages / collections. Is there any quick way to fix that?

0 Likes
Samreen_Soomro
New Member
1 0 0

Hello Lloyd,

Did you manage to find a solution for this?

Samreen

0 Likes
EvetteMP
Tourist
4 0 16

go to product-price.liquid file and add the following after {{ 'products.product.sold_out' | t }}

<br/>{{ variant.price | money }}

code will look something like this...

 

<span class="price-item price-item--regular" data-regular-price>
{% if available %}
{% if compare_at_price > price %}
{{ compare_at_price | money }}
{% else %}
{{ money_price }}
{% endif %}
{% else %}
{{ 'products.product.sold_out' | t }}<br/>{{ variant.price | money }}
{% endif %}
</span>

0 Likes
Crawler
New Member
1 0 0

In the snippets section find file product-price.liquid

Replace this:

<span class="price-item price-item--regular">
{{ 'products.product.sold_out' | t }}
</span>

To this:

<span class="price-item price-item--regular">
{{ money_price }}
</span>

Or to this:

<span class="price-item price-item--regular">
     {{ 'products.product.sold_out' | t }} - {{ money_price }}
</span>
0 Likes
DenisAt
Tourist
8 0 2

This only partially works. It shows now "Sold out" and the price, but when you have product variants - with different prices - and you select the second or third (etc.) variant - the price is always shown from the first variant and does not update. Only after I refresh the page (after changing to a different variant) - then I see the correct price for that variant. I guess some kind of "refresh" needs to be added to the code to work correctly also for variants. 

Would someone know how/what needs to be added?

0 Likes
Serkay
New Member
3 0 0

Hi,

I exactly did what you said but when I refresh the page prices comes next to out of stock sign. But then it disappears in a second.

Here is the video for this: https://files.fm/u/varahaj66

0 Likes