Display "free" instead of $0.00 in Debut Theme

Highlighted
New Member
1 0 0

Hello :)

Can anyone offer any support of how to show Free instead of $0.00 for items listed with no price. Im a new shopify user so any support would help.

 

Thanks :)

0 Likes
Highlighted
Shopify Expert
2684 67 846

Hi C!

There are two places where customer can see the product price: collection listing and product page. While product page requires changes in several places,  colection listing is easy:

Go to Online Store -> Themes, press on the three dots button for your theme and select Edit HTML/CSS, open product-price.liquid  in Snippets.

Locate the following line

{%- assign money_price = price | money -%}

and replace it with the following code:

{% if product.price == 0 %}
  {%- assign money_price = "Free!" -%}
{% else %}
  {%- assign money_price = price | money -%}
{% endif %}

 

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
I am away till Feb-15.
0 Likes
Highlighted
New Member
2 0 0

Does anybody know how to do this in Supply theme?

0 Likes
Highlighted
Shopify Partner
3 0 0

Hi,

This can be achieve through a simple correction in jquery in the product.liquid page

replace this code  

 productPrice.html(Shopify.formatMoney(variant.price, "{{ shop.money_format }}"));
        

correct code

  if(variant.price === 0){
  productPrice.html( 'Free' );
}else{
 productPrice.html(Shopify.formatMoney(variant.price, "{{ shop.money_format }}"));
}

 

 

0 Likes
Highlighted
New Member
2 0 0

Hi Tim, it works in the result page, when I use the search to find the product, but, as soon as I click in the product and it goes to its page, the price zero come out again!

I try to find this code in the other pages in the css but didin`t find it. Could you help me please?

0 Likes
Highlighted
Shopify Expert
2684 67 846

Hi there,

you should look at the product-template.liquid Section. The code you need to change is 

 {{ current_variant.price | money }}

Should become something like:

{% if current_variant.price == 0 %}
  "Free!"
{% else %}
   {{ current_variant.price | money }}
{% endif %}

However, it may be overwritten by the variant selection javascript.

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
I am away till Feb-15.
0 Likes
Highlighted
New Member
3 0 0

Hi There,

Can someone please let me know why {% if product.price == 0 %} works perfectly fine in below code but {% if product.price == 0.99 %} does not work at all. I have to use 0.99 because i have set "assign cents" option in oberlo app which is equal to 99 cents.

{% if product.price == 0 %} {%- assign money_price = "Free!" -%} {% else %} {%- assign money_price = price | money -%} {% endif %}

In short i am using price mutiplier in oberlo as zero to make the product price zero and then want to use above code to show the product as "FREE!". But as i have set assign cents to 99 cents so even after price multipler of zero i have my products price equal to 0.99 cents. So i have to set {% if product.price == 0.99 %}, but it does not work. When i change the price manually to zero and use {% if product.price == 0.00 %} all works fine. please help....

0 Likes
Highlighted
Tourist
8 0 0

Hi, how would the code for variant change?

0 Likes
Highlighted
New Member
8 0 0

Im having the Kalles Theme. 

{%- when 'pricereview' -%}
        <div class="flex wrap fl_between al_center price-review">
           <p class="price_range" id="price{{call_cl}}">
            {%- if nav_up_size == 0 and current_variant.unit_price_measurement -%}
                {%- if price_varies -%}<span class="price_varies">{%- endif -%}
                {%- if on_sale -%}<del>{{ current_variant.compare_at_price  | money }}</del><ins>{{ current_variant.price | money }}</ins>{%- else -%}{{ current_variant.price | money }}{%- endif -%}
                {%- if price_varies -%}</span>{%- endif -%}
               {%- capture unit_price_base_unit -%}
                <span class="unit_base">
                  {%- if current_variant.unit_price_measurement -%}
                    {%- if current_variant.unit_price_measurement.reference_value != 1 -%}
                      {{- current_variant.unit_price_measurement.reference_value -}}
                    {%- endif -%}
                    {{ current_variant.unit_price_measurement.reference_unit }}
                  {%- endif -%}
                </span>
               {%- endcapture -%}
               <span class="price__unit db"><span class="unit_price">{{ current_variant.unit_price | money }}</span><span>/</span>{{- unit_price_base_unit -}}</span>
            {%- elsif nav_up_size == 0 -%}
               {%- if price_varies -%}
                   {%- if block.settings.price == '1' -%}{{ product.price_min | money }} – {{ product.price_max | money }}
                   {%- elsif block.settings.price == '2' -%}<span class="cb fwn">{{ 'products.product.from' | t }}</span> {{ product.price_min | money }}
                   {%- else -%}
                     {%- if on_sale -%}<span class="price_varies current_price"><del>{{ current_variant.compare_at_price | money }}</del> <ins>{{ current_variant.price | money }}</ins></span><style>.nt_cart_form .price {display: none}</style>
                   {%- else -%}<span class="price_varies current_price">{{ current_variant.price | money }}</span><style type="text/css">.nt_cart_form .price {display: none}</style>{%- endif -%}
                     {%- endif -%}
               {%- elsif on_sale -%}<del>{{ current_variant.compare_at_price | money }}</del> <ins>{{ current_variant.price | money }}</ins>
               {%- else -%}{{ current_variant.price | money }}{%- endif -%}
               
            {%- else -%}
              {%- if on_sale -%}
              {{ product.price | money }}–{{ product.compare_at_price | money }}
              {%- else -%}
              {{ product.price | money }}
              {%- endif -%}
            {%- endif -%}

 

What do I have to change in this code in order to show FREE instead of 0,00€ ?

THANK YOU SO MUCH, been trying for hours. But nothing works.

0 Likes