Hello, looking for a solution to hide prices for sold out items in the ‘Boundless’ theme.
All of my sold out items are located in a collection named ‘archive’ which is visible to shoppers but I would like to hide the prices.
Thanks in advance for any help!
1 Like
Hello, @old_jewelry
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.
Hello,
- In your Shopify Admin go to online store > themes > actions > edit code
2- Go to Sections folder > product-template.liquid
3- press ctrl + f and type assign price to search for it
4- add this line of code just above it
{% if product.available %}
5- add this line just under the
{% endif %}
6- click save
The final code should look like that:
Best regards,
Diamond team
Hello,
This hides the price on each individual product page (if sold out)
But does not hide the prices on the archive page, where all sold out items
are displayed.
Please see attached screenshot…
[image: Screen Shot 2020-12-06 at 10.49.59 AM.png]
Hello,
To hide the price of sold out items from collection pages:
- In your Shopify Admin go to online store > themes > actions > edit code
2- Go to Snippets folder > product-grid-item.liquid
3- press ctrl + f and search for product-item__price-wrapper
4- add this line of code just above it
{% if product.available %}
5- add this line just under the
{% endif %}
6- click save
The final code should look like that:
Best regards,
Diamond Team
1 Like
Thank you so much!
This worked!
Hi,
I am using Them Simple.
Can you help showing me how it works for my store?
Url: planet.deluxe-myshopify
Thanks
Hello xdreamineer,
For hiding the price of soldout items from product page:
- In your Shopify Admin go to online store > themes > actions > edit code
2- Go to Sections folder >product-template.liquid
3- press ctrl + f and search for product-single__prices
4- add this line of code just above it
{% if product.available %}
5- add this line just under the
{% endif %}
6- click save
The final code should look like that:
To hide the price of sold out items from collection pages:
- In your Shopify Admin go to online store > themes > actions > edit code
2- Go to Snippets folder >product-grid-item.liquid
3- replace all the code inside this folder with this code:
{% unless grid_item_width %}
{% assign grid_item_width = 'medium-up--one-third small--one-half' %}
{% endunless %}
{% unless current_collection == blank %}
{% assign current_collection = collection %}
{% endunless %}
{% assign on_sale = false %}
{% assign sale_text = 'products.product.sale' | t %}
{% if product.compare_at_price > product.price %}
{% assign on_sale = true %}
{% endif %}
{% assign sold_out = true %}
{% assign sold_out_text = 'products.product.sold_out' | t %}
{% if product.available %}
{% assign sold_out = false %}
{% endif %}
{%- assign img_url = product.featured_image | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%}
{% unless product.featured_image == blank %}
{% else %}
{% endunless %}
{{ product.title }}
{% if section.settings.vendor_show %}
{{ product.vendor }}
{% endif %}
{% if product.available %}
{% if product.compare_at_price > product.price %}
{% if product.price_varies %}
{% assign sale_price = product.price | money %}
{{ 'products.product.on_sale_from_html' | t: price: sale_price }}
{% else %}
**{{ 'products.product.sale_price' | t }}**
{{ product.price | money }}
{% endif %}
{% else %}
{% 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 %}
{% if product.compare_at_price > product.price %}
{{ 'products.product.regular_price' | t }}
~~{{ product.compare_at_price | money }}~~
{% endif %}
{% endif %}
{% if on_sale %}
{{ 'products.product.on_sale' | t }}
{% endif %}
{% comment %}
{% if sold_out %}
{{ 'products.product.sold_out' | t }}
{% endif %}
{% endcomment %}
{% if sold_out %}
— **{{ 'products.product.sold_out' | t }}**
{% endif %}
{% if product.price_varies == false %}
{% include 'product-unit-price', variant: product.selected_or_first_available_variant %}
{% endif %}
Copy
4- click save
Best regards,
Diamond team
1 Like
OMG!!!
Dear Diamond Team, you are my life saver!!! I am not kidding!!!
How would I do this on my theme? https://y48pjmffat8az3sk-53048311980.shopifypreview.com/products_preview?preview_key=feec90f9bf7d62f7af537ea903dcc7d1
Debuitify 3.0.0
{%- assign current_variant = product.selected_or_first_available_variant -%}
{%- assign featured_media = current_variant.featured_media | default: product.featured_media -%}
{%- assign stacked = false -%}
{%- if section.settings.media_layout == “stacked” -%}
{%- assign stacked = true -%}
{%- endif -%}
{%- assign first_media = true -%}
{%- if product.media.size > 1 -%}
{%- assign carousel = true -%}
{%- else -%}
{%- assign carousel = false -%}
{%- endif -%}
{%- if emptyState -%}
{%- assign vendor = ‘home_page.onboarding.product_vendor’ | t -%}
{%- assign sku = ‘12345’ -%}
{%- assign title = ‘home_page.onboarding.product_title’ | t -%}
{%- assign compare_at_price = 2999 -%}
{%- assign price = 1999 -%}
{%- else -%}
{%- assign vendor = product.vendor -%}
{%- assign sku = current_variant.sku -%}
{%- assign title = product.title -%}
{%- assign compare_at_price = current_variant.compare_at_price -%}
{%- assign price = current_variant.price -%}
{%- endif -%}
{%- if compare_at_price > price -%}
{%- assign on_sale = true -%}
{%- else -%}
{%- assign on_sale = false -%}
{%- endif -%}
{%- if current_variant.available -%}
{%- assign sold_out = false -%}
{%- else -%}
{%- assign sold_out = true -%}
{%- endif -%}
I’m using Supply theme. I added these codes above
and it worked just fine but now the grid is not aligned. Each item that was sold is now on a separate line pushing everything out alignment. The screen shots below are when I added the code. I’m removing the code for now to get the images back in the proper alignment.