Hi all,
Can anyone help us in hiding the price for sold-out items?
Thanks.
Hi all,
Can anyone help us in hiding the price for sold-out items?
Thanks.
Hello,
To hide the price of sold out items from collection pages:
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:
Thanks!
I am using Prestige.
Also, i am unable to find “Product-grid”
@JHKCreate can you please look into this.
You should add the following code to:
{% if product.available %}
/--Price Code--\
{% endif %}
Copy
Remove the /–Price Code–\ when trying to add this to your product-template.form file
Let me know!
Not an expert in liquid.
@dmwwebartisan Can you please help me with the same.
Sure, I have attached the file.
sure.
Please follow the steps:
Please backup your Snippets/product-item.liquid file & Replace following code .
{%- comment -%}
We are using LazySizes to efficiently choose the most appropriate image in the set. However, because internally LazySizes uses srcset, we need to make
sure that the image sizes we offer is not larger than the max size uploaded by the merchants.
{%- endcomment -%}
{%- if settings.product_image_size == 'natural' or use_horizontal -%}
{%- assign use_natural_size = true -%}
{%- else -%}
{%- assign use_natural_size = false -%}
{%- endif -%}
{%- if settings.product_show_secondary_image and product.media[1] != blank and use_horizontal != true -%}
{%- assign has_alternate_image = true -%}
{%- else -%}
{%- assign has_alternate_image = false -%}
{%- endif -%}
{%- if use_horizontal -%}
{%- assign max_width = 125 -%}
{%- else -%}
{%- assign max_width = product.featured_media.preview_image.width -%}
{%- endif -%}
{%- assign media_aspect_ratio = product.featured_media.aspect_ratio | default: product.featured_media.preview_image.aspect_ratio -%}
{%- comment -%}
IMPLEMENTATION NOTE: The alternate image (not visible by default) should be the first in the DOM, as the spinner (Image__Loader element) is
displayed based on the immediately previously shown image.
{%- endcomment -%}
{%- if has_alternate_image -%}
{%- capture supported_sizes -%}{%- render 'image-size', sizes: '200,300,400,600,800,900,1000,1200', image: product.media[1] -%}{%- endcapture -%}
{%- assign image_url = product.media[1] | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%}
{%- endif -%}
{%- capture supported_sizes -%}{%- render 'image-size', sizes: '200,400,600,700,800,900,1000,1200', image: product.featured_media -%}{%- endcapture -%}
{%- assign image_url = product.featured_media | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%}
{%- if show_labels -%}
{%- capture product_labels -%}
{%- for tag in product.tags -%}
{%- if tag contains '__label' -%}
{{ tag | split: '__label:' | last }}
{%- break -%}
{%- endif -%}
{%- endfor -%}
{%- if product.available -%}
{%- if product.compare_at_price > product.price -%}
{{ 'product.labels.on_sale' | t }}
{%- endif -%}
{%- else -%}
{{ 'product.labels.sold_out' | t }}
{%- endif -%}
{%- endcapture -%}
{%- if product_labels != blank -%}
{{ product_labels }}
{%- endif -%}
{%- endif -%}
{%- if show_product_info -%}
{%- if show_vendor -%}
{{ product.vendor }}
{%- endif -%}
##
{{ product.title }}
{%- if show_color_swatch -%}
{%- assign color_swatch_list = '' -%}
{%- capture color_swatch -%}
{%- assign color_label = 'color,colour,couleur,colore,farbe,색,色,färg,farve' | split: ',' -%}
{%- capture color_name -%}{{ section.id }}-{{ product.id }}{%- endcapture -%}
{%- for option in product.options_with_values -%}
{%- assign downcased_option = option.name | downcase -%}
{%- if color_label contains downcased_option -%}
{%- assign variant_option = 'option' | append: forloop.index -%}
{%- for value in option.values -%}
{%- assign downcased_value = value | downcase -%}
{%- capture color_id -%}{{ section.id }}-{{ product.id }}-{{ forloop.index }}{%- endcapture -%}
{%- for variant in product.variants -%}
{%- if variant[variant_option] == value -%}
{%- assign variant_for_value = variant -%}
{%- break -%}
{%- endif -%}
{%- endfor -%}
{%- if variant_for_value.image -%}
{%- capture supported_sizes -%}{%- render 'image-size', sizes: '200,400,600,700,800,900,1000,1200', image: variant_for_value.image -%}{%- endcapture -%}
{%- assign variant_image_url = variant_for_value.image | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%}
{%- endif -%}
{%- assign color_swatch_name = value | handle | append: '.png' -%}
{%- assign color_swatch_image = images[color_swatch_name] -%}
{%- endfor -%}
{%- endif -%}
{%- endfor -%}
{%- endcapture -%}
{%- if color_swatch != blank -%}
{%- capture color_swatch_list -%}
{{- color_swatch -}}
{%- endcapture -%}
{%- endif -%}
{%- endif -%}
{%- if show_price_on_hover == nil -%}
{%- assign show_price_on_hover = settings.product_show_price_on_hover -%}
{%- endif -%}
{%- if show_price_on_hover and color_swatch_list != blank -%}
{{- color_swatch_list -}}
{%- endif -%}
{%- if product.template_suffix != 'coming-soon' -%}
{% if product.available %}
{%- if product.compare_at_price > product.price -%}
{{ product.price | money_without_trailing_zeros }}
{{ product.compare_at_price | money_without_trailing_zeros }}
{%- elsif product.price_varies -%}
{%- capture formatted_min_price -%}{{ product.price_min | money_without_trailing_zeros }}{%- endcapture -%}
{%- capture formatted_max_price -%}{{ product.price_max | money_without_trailing_zeros }}{%- endcapture -%}
{{ 'collection.product.from_price_html' | t: min_price: formatted_min_price, max_price: formatted_max_price }}
{%- else -%}
{{ product.price | money_without_trailing_zeros }}
{%- endif -%}
{%- if product.selected_or_first_available_variant.unit_price_measurement -%}
{{ product.selected_or_first_available_variant.unit_price | money_without_trailing_zeros }}
/
{{- product.selected_or_first_available_variant.unit_price_measurement.reference_value -}}
{{ product.selected_or_first_available_variant.unit_price_measurement.reference_unit }}
{%- endif -%}
{% endif %}
{%- endif -%}
{%- if show_price_on_hover == false and color_swatch_list != blank -%}
{{- color_swatch_list -}}
{%- endif -%}
{%- endif -%}
{%- if use_horizontal -%}
{{ 'collection.product.view_product' | t }}
{%- endif -%}
after add this code please check collection page
Thanks!
This is working fine for the collection page, however, on the product page price is getting displayed. @dmwwebartisan
Please backup your Snippets/product-meta.liquid file & Replace following code .
{%- if section.settings.show_vendor and product.vendor != blank -%}
##
{%- assign vendor_handle = product.vendor | handle -%}
{%- assign collection_for_vendor = collections[vendor_handle] -%}
{%- unless collection_for_vendor.empty? -%}
{{ product.vendor }}
{%- else -%}
{{- product.vendor -}}
{%- endunless -%}
{%- endif -%}
#
{%- if template.name == 'product' -%}
{{- product.title -}}
{%- else -%}
{{ product.title }}
{%- endif -%}
{%- if section.settings.show_sku and product.selected_or_first_available_variant.sku != blank -%}
{{ 'product.form.sku' | t }}: {{ product.selected_or_first_available_variant.sku }}
{%- endif -%}
{%- if product.template_suffix != 'coming-soon' -%}
{% if product.available %}
{%- if product.selected_or_first_available_variant.compare_at_price > product.selected_or_first_available_variant.price -%}
{{ product.selected_or_first_available_variant.price | money_without_trailing_zeros }}
{{ product.selected_or_first_available_variant.compare_at_price | money_without_trailing_zeros }}
{%- else -%}
{{ product.selected_or_first_available_variant.price | money_without_trailing_zeros }}
{%- endif -%}
{{ product.selected_or_first_available_variant.unit_price | money_without_trailing_zeros }}
/
{{ product.selected_or_first_available_variant.unit_price_measurement.reference_value }}
{{ product.selected_or_first_available_variant.unit_price_measurement.reference_unit }}
{% endif %}
{%- endif -%}
{%- if section.settings.show_taxes_included -%}
{%- if shop.taxes_included or shop.shipping_policy.body != blank -%}
{%- if shop.taxes_included -%}
{{ 'product.general.include_taxes' | t }}
{%- endif -%}
{%- if shop.shipping_policy.body != blank -%}
{{ 'product.general.shipping_policy_html' | t: link: shop.shipping_policy.url }}
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- if show_description and section.settings.description_below_add_to_cart == false -%}
{%- comment -%}
We have figured out that some merchants were copy-pasting huge chunk of code into the product description,
which can make the theme crashes if it contains some special attributes used by the theme. We therefore make sure to process this
{%- endcomment -%}
{{ product.description | replace: 'data-section-type', 'data-section-type-placeholder' }}
{%- if section.settings.show_share_buttons -%}
{{ 'product.form.share' | t }}
{%- assign share_url = shop.url | append: product.url -%}
{%- assign twitter_text = product.title -%}
{%- assign pinterest_description = product.description | strip_html | truncatewords: 15 | url_param_escape -%}
{%- assign pinterest_image = product.featured_image | img_url: 'large' | prepend: 'https:' -%}
[{%- render 'icon' with 'facebook' -%}](https://www.facebook.com/sharer.php?u={{ share_url }})
[{%- render 'icon' with 'twitter' -%}](https://twitter.com/share?{% if twitter_text != blank %}text={{twitter_text}}&{% endif %}url={{ share_url }})
[{%- render 'icon' with 'pinterest' -%}](https://pinterest.com/pin/create/button/?url={{ share_url }}{% if pinterest_image != blank %}&media={{ pinterest_image }}{% endif %}&description={{ pinterest_description }})
{%- endif -%}
{%- endif -%}
after adding this please check product page
Thanks!
thanks.
Thank you so much @dmwwebartisan for the support.
If helpful then please Like Solution.