I’ve looked all over for the answer to this, but have been unable to find something that works.
I have some products that range from $49.99 - $69.99 (4 variants), but when showing on the Collection pages, the lower-priced variant is what appears. How can I add the range of variants to those collection pages? I’ve seen others mention updating the code on the product-price.liquid snippets, but I don’t even see a snippet like that.
Any help would be greatly appreciated. Thanks!
Hi @JohnnyC
Would you mind sharing your store’s URL so we can provide a solution for that? Try looking into a product-grid-item file instead.
Let me know!
You’ll see the product titled Beach Hooded Blanket shows $49.99, but when you open the product, it then shows the higher priced variant of $69.99
Here’s the coding for product-grid-item-liquid
{% assign has_color_swatches = false %}
{%- if content_for_header contains ‘debutify’ and settings.dbtfy_color_swatches -%}
{%- if settings.dbtfy_color_swatches_grid != blank -%}
{%- if product.available and product.variants.size > 1 -%}
{% assign has_color_swatches = true %}
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- if emptyState -%}
{%- assign product_link = ‘/admin/products’ -%}
{%- assign vendor = ‘home_page.onboarding.product_vendor’ | t -%}
{%- assign title = ‘home_page.onboarding.product_title’ | t -%}
{%- assign compare_at_price = 2999 -%}
{%- assign price = 1999 -%}
{%- else -%}
{%- assign variant = product.first_available_variant -%}
{%- assign product_link = product.url | within: collection -%}
{%- assign vendor = product.vendor -%}
{%- assign title = product.title -%}
{%- assign compare_at_price = product.compare_at_price -%}
{%- assign price = product.price -%}
{%- endif -%}
{%- if compare_at_price > price -%}
{%- assign on_sale = true -%}
{%- else -%}
{%- assign on_sale = false -%}
{%- endif -%}
{%- if product.available or emptyState -%}
{%- assign sold_out = false -%}
{%- else -%}
{%- assign sold_out = true -%}
{%- endif -%}
{%- if settings.grid_product_hover and product.images.size > 1 -%}
{%- assign image_hover = true -%}
{%- else -%}
{%- assign image_hover = false -%}
{%- endif -%}
{%- assign variant = product.selected_or_first_available_variant -%}
{%- if settings.dbtfy_sales_countdown -%}
{%- endif -%}
Replace all the code you sent with the below:
{% assign has_color_swatches = false %}
{%- if content_for_header contains 'debutify' and settings.dbtfy_color_swatches -%}
{%- if settings.dbtfy_color_swatches_grid != blank -%}
{%- if product.available and product.variants.size > 1 -%}
{% assign has_color_swatches = true %}
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- if emptyState -%}
{%- assign product_link = '/admin/products' -%}
{%- assign vendor = 'home_page.onboarding.product_vendor' | t -%}
{%- assign title = 'home_page.onboarding.product_title' | t -%}
{%- assign compare_at_price = 2999 -%}
{%- assign price = 1999 -%}
{%- else -%}
{%- assign variant = product.first_available_variant -%}
{%- assign product_link = product.url | within: collection -%}
{%- assign vendor = product.vendor -%}
{%- assign title = product.title -%}
{%- assign compare_at_price = product.compare_at_price -%}
{%- assign price = product.price -%}
{%- endif -%}
{%- if compare_at_price > price -%}
{%- assign on_sale = true -%}
{%- else -%}
{%- assign on_sale = false -%}
{%- endif -%}
{%- if product.available or emptyState -%}
{%- assign sold_out = false -%}
{%- else -%}
{%- assign sold_out = true -%}
{%- endif -%}
{%- if settings.grid_product_hover and product.images.size > 1 -%}
{%- assign image_hover = true -%}
{%- else -%}
{%- assign image_hover = false -%}
{%- endif -%}
{%- assign variant = product.selected_or_first_available_variant -%}
{%- if product.images != blank -%}
{%- if image_hover -%}
{%- endif -%}
{%- elsif product.images.size < 1 or emptyState -%}
{{ 'product-' | append: current | placeholder_svg_tag: 'card-image placeholder-svg' }}
{%- endif -%}
{%- unless settings.tag_placement == 'none' -%}
{%- if sold_out -%}
watch_later
{{ 'products.product.sold_out_html' | t }}
{%- elsif on_sale -%}
{%- capture highest_discount -%}
{%- assign max_price = 0 -%}
{%- for variant in product.variants -%}
{%- if variant.compare_at_price > variant.price -%}
{%- if settings.sale_type == 'amount' -%}
{% assign discount_price = variant.compare_at_price | minus: variant.price %}
{%- elsif settings.sale_type == 'percentage' -%}
{% assign discount_price = variant.compare_at_price | minus: variant.price | times: 100 | divided_by: variant.compare_at_price %}
{%- endif -%}
{%- if discount_price > max_price -%}
{%- assign max_price = discount_price -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- if settings.sale_type == 'amount' -%}
{{ max_price | money }}
{%- elsif settings.sale_type == 'percentage' -%}
{{ max_price }}%
{%- endif -%}
{%- endcapture -%}
local_offer
{{ 'products.general.save_html' | t: saved_amount: highest_discount }}
{%- endif -%}
{%- endunless -%}
{%- unless emptyState -%}
{%- render "dbtfy-quick-view" with product as product -%}
{%- render "dbtfy-wish-list" with product as product -%}
{%- endunless -%}
{%- unless emptyState -%}
{%- if product != blank -%}
{%- render "dbtfy-collection-addtocart" with product as product, sold_out: sold_out -%}
{%- endif -%}
{%- endunless -%}
{%- if has_color_swatches -%}
{%- render "dbtfy-color-swatches" with product as product, type: 'product_grid' -%}
{%- endif -%}
{{ title }}
{%- if settings.review_badge_product_grid -%}
{%- unless emptyState -%}
{%- render "review-badge" with product as product, position: "product_grid" -%}
{%- endunless -%}
{%- endif -%}
{%- if settings.dbtfy_color_swatches -%}
{%- if product.price_varies and emptyState == false -%}
{{ product.price_min | money }} - {{product.price_max}}
{%- else -%}
{{ price | money }}
{%- endif -%}
{%- else -%}
{%- if product.price_varies and emptyState == false -%}
{{ product.price_min | money }} +
{%- else -%}
{{ price | money }}
{%- endif -%}
{%- endif -%}
{%- if on_sale -%}
{{ compare_at_price | money }}
{%- else -%}
{%- endif -%}
{%- if variant.available and variant.unit_price_measurement -%}
{%- capture unit_price_separator -%}
/ {{ 'general.accessibility.unit_price_separator' | t }}
{%- endcapture -%}
{%- capture unit_price_base_unit -%}
{%- if variant.unit_price_measurement.reference_value != 1 -%}
{{- variant.unit_price_measurement.reference_value -}}
{%- endif -%}
{{ variant.unit_price_measurement.reference_unit }}
{%- endcapture -%}
{{ 'products.general.unit_price' | t }}
{{ variant.unit_price | money }}{{- unit_price_separator -}}{{- unit_price_base_unit -}}
{%- endif -%}
{%- if settings.grid_product_vendor -%}
{{ vendor }}
{%- endif -%}
{%- if settings.dbtfy_sales_countdown -%}
{%- endif -%}
Line 145 is where the change is at , showing the min + max as a range.
Should that help answer your query, we always appreciate a like & mark as answer to let the community find quality answers faster. Thanks!