Personalized checkout and custom promotions with Shopify Scripts
Hi!
I need help to hide the price for out of stock items on a collection page - Warehouse Theme.
Many items we stock are Priced On Application, so are not technically 'Out of Stock', but their inventory will always be '0'. Prices can change for the items, so we do not want a fixed price listed on the site.
I have managed to set up a product page template for these items where I have removed the price and changed the 'add to cart' button to an email link, but I am struggling to remove price for specific products on collection page, and search function. Closest I have got is removing all the prices completely.
I believe the code for it is in Snippet 'product-item.liquid' in this section:
<div class="product-item__info">
<div class="product-item__info-inner">
{%- capture price_list -%}
<div class="product-item__price-list price-list">
{%- if product.price < product.compare_at_price -%}
{%- if product.compare_at_price_varies -%}
{%- capture price_min -%}<span>{{ product.price_min | money_without_trailing_zeros }}</span>{%- endcapture -%}
{%- capture price_max -%}<span>{{ product.price_max | money_without_trailing_zeros }}</span>{%- endcapture -%}
<span class="price price--highlight">{{ 'collection.product.from_price_html' | t: price_min: price_min, price_max: price_max }}</span>
<span class="price price--compare">{{ product.compare_at_price_min | money_without_trailing_zeros }}</span>
{%- else -%}
<span class="price price--highlight">{{ product.price | money_without_trailing_zeros }}</span>
<span class="price price--compare">{{ product.compare_at_price | money_without_trailing_zeros }}</span>
{%- endif -%}
{%- elsif product.price_varies -%}
{%- capture price_min -%}<span>{{ product.price_min | money_without_trailing_zeros }}</span>{%- endcapture -%}
{%- capture price_max -%}<span>{{ product.price_max | money_without_trailing_zeros }}</span>{%- endcapture -%}
<span class="price">{{ 'collection.product.from_price_html' | t: price_min: price_min, price_max: price_max }}</span>
{%- else -%}
<span class="price">{{ product.price | times:1.20 | money_without_trailing_zeros }} Inc-Vat</span>
<span>{{ product.price | money_without_trailing_zeros }} Ex-Vat</span>
{%- endif -%}
</div>
{%- if product.selected_or_first_available_variant.unit_price_measurement -%}
<div class="product-item__price-info">
<div class="unit-price-measurement">
<span class="unit-price-measurement__price">{{ product.selected_or_first_available_variant.unit_price | money_without_trailing_zeros }}</span>
<span class="unit-price-measurement__separator">/ </span>
{%- if product.selected_or_first_available_variant.unit_price_measurement.reference_value != 1 -%}
<span class="unit-price-measurement__reference-value">{{ product.selected_or_first_available_variant.unit_price_measurement.reference_value }}</span>
{%- endif -%}
<span class="unit-price-measurement__reference-unit">{{ product.selected_or_first_available_variant.unit_price_measurement.reference_unit }}</span>
</div>
</div>
{%- endif -%}
{%- endcapture -%}
I cannot seem to find the correct solution to get '.product-item__price-list price-list to display none or visibility hidden' if inventory is 0.
Also, looking to do this without an app as well. Im fairly competent with code, but any help would be great!
TIA
Hello!
You can condition for check product is available or not, try this once:
{% if product.available %}
<YOUR CODE FOR PRICE/>
{% endif %}
Thanks!
Hi!
Thanks for your response, and time.
I initially tried to wrap the pricing code in an if available tag, but had no joy with it.
I also tried a 'less than' operator tag, and they all disappeared. So I'm in the right place for it/ on the right track, just cant find the correct logic to achieve what I want it to.
Thanks again!
As a business owner, have you ever wondered when your customer's first impression of yo...
By Skye Jun 6, 2023We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023