Here is my code:
<!-- snippet/product-price.liquid -->
{% if product.title %}
{%- assign compare_at_price = product.compare_at_price -%}
{%- assign price = product.price -%}
{%- assign price_varies = product.price_varies -%}
{%- assign available = product.available -%}
{% else %}
{%- assign compare_at_price = 1999 -%}
{%- assign price = 1999 -%}
{%- assign price_varies = true -%}
{%- assign available = true -%}
{% endif %}
{%- assign money_price = price | money -%}
{% if compare_at_price > price %}
<span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
<s class="product-price__price">{{ compare_at_price | money }}</s>
<span class="product-price__price product-price__sale">
{{ money_price }}
</span>
{% if settings.show_saved_amount and settings.show_discount_amount == 'money_save' %}
<span class="salePrice sale-tag large">
{% assign sale = product.compare_at_price | minus: product.price | money %}
{{ 'products.product.on_save_like_price' | t }} {{sale}}
</span>
{% endif %}
{% else %}
<span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
<span class="product-price__price">{{ money_price }}</span>
{% endif %}
can anyone help me out on how to show the prices on my store from (Minimum) to (Minimum-Maximum) format?
Thanks alot
Solved! Go to the solution
Hey @ProteinTakeOut ,
I may be able to help you, but need a bit more detail to understand your question. Here's an example product:
Normally, your pricing on this product looks like this:
$7.99 $5.99
How do you want your prices to look differently?
Brian | Shopify Partner | Ecommerce Consultant
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
- Need further assistance? Visit www.BrianAtWork.com
@ProteinTakeOut Try this out:
Before you customize your theme:
Edit your theme file code:
Paste this code at the top of your file:
{%- assign money_price_min = product.price_min | money -%} {%- assign money_price_max = product.price_max | money -%}
Find the two places in your code that have {{ money_price }}, and replace that code with this code:
{%- if price_varies -%} {{ money_price_min }} - {{ money_price_max }} {%- else -%} {{ money_price }} {%- endif -%}
Let me know if this solves your problem or if you need further help!
Brian | Shopify Partner | Ecommerce Consultant
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
- Need further assistance? Visit www.BrianAtWork.com
This is an accepted solution.
@ProteinTakeOut Let's fix that. Here's your original code snippet with my suggestions added in. You should be able to save this:
{%- assign money_price_min = product.price_min | money -%} {%- assign money_price_max = product.price_max | money -%} {% if product.title %} {%- assign compare_at_price = product.compare_at_price -%} {%- assign price = product.price -%} {%- assign price_varies = product.price_varies -%} {%- assign available = product.available -%} {% else %} {%- assign compare_at_price = 1999 -%} {%- assign price = 1999 -%} {%- assign price_varies = true -%} {%- assign available = true -%} {% endif %} {%- assign money_price = price | money -%} {% if compare_at_price > price %} <span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span> <s class="product-price__price">{{ compare_at_price | money }}</s> <span class="product-price__price product-price__sale"> {%- if price_varies -%} {{ money_price_min }} - {{ money_price_max }} {%- else -%} {{ money_price }} {%- endif -%} </span> {% if settings.show_saved_amount and settings.show_discount_amount == 'money_save' %} <span class="salePrice sale-tag large"> {% assign sale = product.compare_at_price | minus: product.price | money %} {{ 'products.product.on_save_like_price' | t }} {{sale}} </span> {% endif %} {% else %} <span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span> <span class="product-price__price"> {%- if price_varies -%} {{ money_price_min }} - {{ money_price_max }} {%- else -%} {{ money_price }} {%- endif -%} </span> {% endif %}
Brian | Shopify Partner | Ecommerce Consultant
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
- Need further assistance? Visit www.BrianAtWork.com
Hello Brian,
My product-price.liquid code in Debut theme is different. How can it be modified to display products price range min-max?
this is my code
{% comment %} Renders a list of product's price (regular, sale, unit) Accepts: - variant: {Object} Variant Liquid object (optional) - product: {Object} Product Liquid object (optional) - show_vendor: {Boolean} Show the product's vendor depending on the section setting (optional) Usage: {% include 'product-price', variant: current_variant, product: product %} {% endcomment %} {% if variant.title %} {%- assign compare_at_price = variant.compare_at_price -%} {%- assign price = variant.price -%} {%- assign available = variant.available -%} {% else %} {%- assign compare_at_price = 1999 -%} {%- assign price = 1999 -%} {%- assign available = true -%} {% endif %} {%- assign money_price = price | money -%} <dl class="price {% if available == false %} price--sold-out {% endif %} {% if available and compare_at_price > price %} price--on-sale {% endif %} {% if available and variant.unit_price_measurement %} price--unit-available {% endif %}" data-price > {% if show_vendor and product %} <div class="price__vendor"> <dt> <span class="visually-hidden">{{ 'products.product.vendor' | t }}</span> </dt> <dd> {{ product.vendor }} </dd> </div> {% endif %} <div class="price__regular"> <dt> <span class="visually-hidden visually-hidden--inline">{{ 'products.product.regular_price' | t }}</span> </dt> <dd> <span class="price-item price-item--regular" data-regular-price> {{ money_price }} </span> </dd> </div> <div class="price__sale"> <dt> <span class="visually-hidden visually-hidden--inline">{{ 'products.product.regular_price' | t }}</span> </dt> <dd> <s class="price-item price-item--regular" data-regular-price> {{ compare_at_price | money }} </s> </dd> <dt> <span class="visually-hidden visually-hidden--inline">{{ 'products.product.sale_price' | t }}</span> </dt> <dd> <span class="price-item price-item--sale" data-sale-price> {{ money_price }} </span> <span class="price-item__label price-item__label--sale" aria-hidden="true">{{ 'products.product.on_sale' | t }}</span> </dd> </div> <div class="price__unit"> <dt> <span class="visually-hidden visually-hidden--inline">{{ 'products.product.unit_price_label' | t }}</span> </dt> <dd class="price-unit-price"> {%- capture unit_price_separator -%} <span aria-hidden="true">/</span><span class="visually-hidden">{{ 'general.accessibility.unit_price_separator' | t }} </span> {%- endcapture -%} {%- capture unit_price_base_unit -%} <span data-unit-price-base-unit> {%- if available and variant.unit_price_measurement -%} {%- if variant.unit_price_measurement.reference_value != 1 -%} {{- variant.unit_price_measurement.reference_value -}} {%- endif -%} {{ variant.unit_price_measurement.reference_unit }} {%- endif -%} </span> {%- endcapture -%} <span data-unit-price>{{ variant.unit_price | money }}</span>{{- unit_price_separator -}}{{- unit_price_base_unit -}} </dd> </div> <div class="price__availability"> <dt> <span class="visually-hidden visually-hidden--inline">{{ 'products.product.availability' | t }}</span> </dt> <dd> <span class="price-item price-item--regular"> {{ 'products.product.sold_out' | t }} </span> </dd> </div> </dl>
User | Count |
---|---|
25 | |
23 | |
22 | |
19 | |
13 |