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?
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!
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>
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>
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?
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
User | Count |
---|---|
21 | |
18 | |
13 | |
11 | |
11 |