Need to change price display from minimum to Minimum - Maximum

Solved
ProteinTakeOut
Tourist
5 0 1

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

0 Likes
ProteinTakeOut
Tourist
5 0 1

anyone knows?

0 Likes
BrianAtWork
Shopify Partner
242 58 133

Hey @ProteinTakeOut ,

 

I may be able to help you, but need a bit more detail to understand your question. Here's an example product:

 

  • Price: $5.99
  • Compare at price $7.99

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

0 Likes
ProteinTakeOut
Tourist
5 0 1
my standard pricing right now is displayed on Minimum, so let'a say I sell bags of 1 pound of protein for 11.99$ and the same bag could be 59.99 at 6 pounds, the product actually shows at 11.99$ and i would like it to be 11,99$-59,99$ on standard display
0 Likes
BrianAtWork
Shopify Partner
242 58 133

@ProteinTakeOut Try this out:

 

Before you customize your theme:

 

  • Duplicate your theme to create a backup copy. This makes it easy to discard your changes and start again if you need to.

 

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

0 Likes
ProteinTakeOut
Tourist
5 0 1

Wouldn't let me save it, error code.

0 Likes
BrianAtWork
Shopify Partner
242 58 133

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

0 Likes
ProteinTakeOut
Tourist
5 0 1

Thank you, it's working!

Polsan
Shopify Partner
24 1 3

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 }}&nbsp;</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>
0 Likes
Christin
Excursionist
18 2 8

Hello! :)

 

I want to do this the other way around. I have minimum to maximum price, which is not allowed in Germany.

I have to change prices from "min to max to "from" In this example "From 19,20". Is this possile somehow?price.JPG

0 Likes