Hi
I’m trying to remove the prices for sold-out items on Prestige.
From my understanding, all I need is an if statement around the price code. But, I can’t seem to find the price code. Any pointers would be appreciated.
I’ve looked under:
Snippet → product-form.liquid & product-item.liquid.
(Product-form.liquid)
{%- comment -%}
Those are the option names for which we automatically detect swatch. For the color, we use them to display a swatch, while
for size, we use it to display a size chart (if applicable)
{%- endcomment -%}
{%- assign color_label = 'color,colour,couleur,colore,farbe,색,色,färg,farve' | split: ',' -%}
{%- assign size_label = 'size,taille,größe,tamanho,tamaño,koko,サイズ' | split: ',' -%}
{%- assign size_chart_page = '' -%}
{%- assign product_popovers = '' -%}
{%- assign show_option_label = false -%}
{%- assign selected_variant = product.selected_or_first_available_variant -%}
{%- form 'product', product, class: 'ProductForm' -%}
{%- unless product.has_only_default_variant -%}
{%- for option in product.options_with_values -%}
{%- assign downcase_option = option.name | downcase -%}
{%- if section.settings.selector_mode == 'block' or color_label contains downcase_option and section.settings.show_color_swatch -%}
{%- assign show_option_label = true -%}
{%- endif -%}
{%- endfor -%}
{%- for option in product.options_with_values -%}
{%- assign downcase_option = option.name | downcase -%}
{%- capture popover_id -%}popover-{{ product.id }}-{{ section.id }}-{{ option.name | handle }}{%- endcapture -%}
{%- if show_option_label -%}
{%- assign size_chart_page = pages['size-chart'] -%}
{{ option.name }}:
{% if color_label contains downcase_option and section.settings.show_color_swatch %}
{{ option.selected_value }}
{% endif %}
{%- if size_label contains downcase_option and size_chart_page != empty -%}
{%- endif -%}
{%- endif -%}
{%- if color_label contains downcase_option and section.settings.show_color_swatch -%}
{%- for value in option.values -%}
{%- assign downcase_value = value | downcase -%}
- {%- assign color_swatch_name = value | handle | append: '.png' -%}
{%- assign color_swatch_image = images[color_swatch_name] -%}
{%- endfor -%}
{%- elsif section.settings.selector_mode == 'block' -%}
{%- for value in option.values -%}
-
{%- endfor -%}
{%- else -%}
{%- capture popover_html -%}
{%- if color_label contains downcase_option and section.settings.show_color_carousel -%}
{%- for value in option.values -%}
{%- if value == option.selected_value -%}
{%- assign initial_image_index = forloop.index0 -%}
{%- break -%}
{%- endif -%}
{%- endfor -%}
{%- capture flickity_options -%}
{
"prevNextButtons": true,
"pageDots": true,
"initialIndex": {{ initial_image_index }},
"arrowShape": {"x0": 20, "x1": 60, "y1": 40, "x2": 60, "y2": 35, "x3": 25}
}
{%- endcapture -%}
{%- capture option_index -%}option{{ option.position }}{%- endcapture -%}
{%- assign option_indexes_excluded_color = '' -%}
{%- assign selected_variant_title_excluded_color = '' -%}
{%- for option_nested in product.options_with_values -%}
{%- if option_nested.position != option.position -%}
{%- assign option_indexes_excluded_color = option_indexes_excluded_color | append: option_nested.position | append: ',' -%}
{%- for option_nested_value in option_nested.values -%}
{%- if option_nested_value == option_nested.selected_value -%}
{%- assign selected_variant_title_excluded_color = selected_variant_title_excluded_color | append: option_nested_value -%}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- endfor -%}
{%- assign option_indexes_excluded_color = option_indexes_excluded_color | split: ',' | compact -%}
{%- for value in option.values -%}
{%- for variant in product.variants -%}
{%- if variant[option_index] == value -%}
{%- assign variant_image = variant.image | default: product.featured_image -%}
{%- assign variant_title_excluded_color = '' -%}
{%- for option_index_excluded_color in option_indexes_excluded_color -%}
{%- capture sub_option_index -%}option{{ option_index_excluded_color }}{%- endcapture -%}
{%- assign variant_title_excluded_color = variant_title_excluded_color | append: variant[sub_option_index] -%}
{%- endfor -%}
{%- capture supported_sizes -%}{%- render 'image-size', sizes: '200,400,600,800', image: variant_image -%}{%- endcapture -%}
{%- assign image_url = variant_image | img_url: '1x1' | replace: '_1x1.', '_{width}x.' -%}
{%- endif -%}
{%- endfor -%}
{%- endfor -%}
{%- for value in option.values -%}
{%- assign min_price_for_variant = product.price_max -%}
{%- for variant in product.variants -%}
{%- if variant[option_index] == value -%}
{%- assign min_price_for_variant = min_price_for_variant | at_most: variant.price -%}
{%- endif -%}
{%- endfor -%}
{%- assign downcase_value = value | downcase -%}
{%- assign color_swatch_name = value | handle | append: '.png' -%}
{%- assign color_swatch_image = images[color_swatch_name] -%}
{{ value }}
{%- if available_prices_for_option_value.size > 1 -%}
{%- capture formatted_min_price -%}{{ min_price_for_variant | money_without_trailing_zeros }}{%- endcapture -%}
{{ 'product.form.from_price_html' | t: min_price: formatted_min_price }}
{%- else -%}
{{ min_price_for_variant | money_without_trailing_zeros }}
{%- endif -%}
{%- endfor -%}
{%- else -%}
{%- for value in option.values -%}
{%- endfor -%}
{%- assign size_chart_page = pages['size-chart'] -%}
{%- if show_option_label == false and size_label contains downcase_option and size_chart_page != empty -%}
{%- endif -%}
{%- endif -%}
{%- endcapture -%}
{%- assign product_popovers = product_popovers | append: popover_html -%}
{%- endif -%}
{%- endfor -%}
{%- render 'icon' with 'select-arrow' -%}
{%- else -%}
{%- endunless -%}
{%- if section.settings.show_quantity_selector -%}
{%- if show_option_label -%}
{{ 'product.form.quantity' | t }}:
{%- endif -%}
{%- assign quantity_minus_one = line_item.quantity | minus: 1 -%}
{%- else -%}
{%- endif -%}
{%- if section.settings.show_inventory_quantity -%}
{%- assign hide_inventory_quantity_by_default = false -%}
{%- if selected_variant.inventory_management == blank or selected_variant.inventory_quantity <= 0 -%}
{%- assign hide_inventory_quantity_by_default = true -%}
{%- endif -%}
{%- if section.settings.inventory_quantity_threshold != 0 and selected_variant.inventory_quantity > section.settings.inventory_quantity_threshold -%}
{%- assign hide_inventory_quantity_by_default = true -%}
{%- endif -%}
{%- if section.settings.inventory_quantity_threshold == 0 -%}
{{- 'product.form.inventory_quantity_count' | t: count: selected_variant.inventory_quantity -}}
{%- else -%}
{{- 'product.form.low_inventory_quantity_count' | t: count: selected_variant.inventory_quantity -}}
{%- endif -%}
{%- endif -%}
{%- comment -%}
--------------------------------------------------------------------------------------------------------------------
ADD TO CART BUTTON
--------------------------------------------------------------------------------------------------------------------
{%- endcomment -%}
{%- if section.settings.show_payment_button == false or product.selling_plan_groups.size > 0 -%}
{%- assign use_primary_button = true -%}
{%- else -%}
{%- assign use_primary_button = false -%}
{%- endif -%}
{%- if section.settings.show_payment_button and product.template_suffix != 'pre-order' -%}
{{ form | payment_button }}
{%- endif -%}
{{ form | payment_terms }}
{%- comment -%}The availability container will be added automatically if there is store pickup available{%- endcomment -%}
{%- if section.settings.show_pickup_availability -%}
{%- endif -%}
{%- endform -%}
{%- if size_chart_page != empty -%}
{%- comment -%}If we have a size chart we capture the modal content (it must be displayed outside the form for proper positioning){%- endcomment -%}
{%- capture product_modals -%}
{{- size_chart_page.content -}}
{%- endcapture -%}
{%- endif -%}
{%- if section.settings.show_payment_button and selected_variant.available == false -%}
{%- endif -%}
{%- comment -%}
--------------------------------------------------------------------------------------------------------------------
OFF SCREEN ELEMENTS
Implementation note: in the past (with "include") we could accumulate the data and output it outside the snippet
itself. However with the new "render" tag, everything that is captured inside cannot be used outside the snippet
itself. As a consequence we are moving them in JavaScript. This allows to make sure that those elements are upper
in the DOM tree, and do not show below the content
--------------------------------------------------------------------------------------------------------------------
{%- endcomment -%}
{{- product_popovers -}}
{{- product_modals -}}
{% comment %}
------------------------------------------------------------------------------
Product Data. This must be outputted for all products (including home page).
IMPORTANT: THIS CODE IS VITAL. DO NOT EDIT IT NOT REMOVE IT. MAKE SURE TO KEEP
THE EXACT SAME ATTRIBUTES.
------------------------------------------------------------------------------
{% endcomment %}
(Product-item.liquid) (here I managed to make the price disappear on hover for the item, but the price still shows in the product description)
{%- 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.available%}
{%- if product.template_suffix != 'coming-soon' -%}
{%- 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 -%}
{%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 -%}
{%- 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 -%}