Hide Prices for Products Priced $0 ONLY on Collection Pages and Product Pages - Minimal Theme

auroradreamsco
Excursionist
16 0 3

Hi! I have collection pages of items I'd like to sell, and collection pages of items that are sold, but that I want to display. I'd like to hide the prices for ONLY the products priced at $0, on the collections pages AND product pages. I have found many solutions across the web, but none of them have worked. The only thing I have successfully done is hide ALL product prices. I'm using the minimal theme with many adjustments already made. Please help! Thank you very much!

KetanKumar
Shopify Partner
14144 1649 5076

HEllo, @auroradreamsco 

Welcome to the Shopify community!
and Thanks for your Good question.

Please share your site URL,
So I will check and provide a solution here.

 

If helpful then please Like and Accept Solution.
Want to modify or custom changes on store Hire me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help
Shopify Expert | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
0 Likes
auroradreamsco
Excursionist
16 0 3

Thank you so much!! 

https://aurora-dreams-co.myshopify.com/

Password: temppasstab

KetanKumar
Shopify Partner
14144 1649 5076

@auroradreamsco 

Thanks 

It can be done by doing some code customization. please send me a personal message and we can discuss what you'd like

 

If helpful then please Like and Accept Solution.
Want to modify or custom changes on store Hire me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help
Shopify Expert | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
0 Likes
auroradreamsco
Excursionist
16 0 3

I sent you a message!

KetanKumar
Shopify Partner
14144 1649 5076

@auroradreamsco 

Thanks for your support.

If helpful then please Like and Accept Solution.
Want to modify or custom changes on store Hire me.
- Feel free to contact me on bamaniyaketan.sky@gmail.com regarding any help
Shopify Expert | Skype : bamaniya.sky
PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO & Digital Marketing
0 Likes
auroradreamsco
Excursionist
16 0 3

The person above could not help me. Does anyone have an answer? 

0 Likes
adahung
New Member
1 0 0

Hi, 

I hope my experience can help you. As inspired by https://community.shopify.com/c/Shopify-Design/How-to-hide-the-price-on-0-items/td-p/380155, we can do similar thing in minimal theme to hide the price ($0) in

1. product detail page

2. add to cart

3. collection page (Not perfect, I am still thinking a better way T^T)

First, for 1. product detail page,

please go to product-template.liquid of sections

use CTRL+F to find "ProductPrice"

you may see sth like this

<span id="ProductPrice" class="product-single__price" itemprop="price" content="{{ product.price | divided_by: 100.00 }}">
{{ product.price | money }}
</span>

please add {% if variant.price > 0 %} in front of this code and add  {% endif %} at the end of this code

you will make sth like this

{% if variant.price > 0 %}
      <span id="ProductPrice" class="product-single__price" itemprop="price" content="{{ product.price | divided_by: 100.00 }}">
{{ product.price | money }}
      </span>
{% endif %}

Second, for 2. add to cart function.

Please go to product-template.liquid of sections, too

for the add to cart button

use CTRL+F to find "AddToCart" 

you may see the following code. 

<button type="submit" name="add" id="AddToCart" class="btn {{ btn_class }}{% if section.settings.enable_payment_button and product.selling_plan_groups == empty %} btn--secondary{% endif %}">
     <span id="AddToCartText">{{ 'products.product.add_to_cart' | t }}</span>
</button>

please add {% if variant.price > 0 %} in front of this code and add  {% endif %} at the end of this code

you will make sth like this

{% if variant.price > 0 %}
     <button type="submit" name="add" id="AddToCart" class="btn {{ btn_class }}{% if section.settings.enable_payment_button and product.selling_plan_groups == empty %} btn--secondary{% endif %}">
            <span id="AddToCartText">{{ 'products.product.add_to_cart' | t }}</span>
     </button>
{% endif %}

for the Buy Now button, its code is right down the aforementioned code

you may see sth like

{% if section.settings.enable_payment_button %}
      {{ form | payment_button }}
{% endif %}

please add {% if variant.price > 0 %} in front of this code and add  {% endif %} at the end of this code like what we have done before. 

you will see sth like

{% if variant.price > 0 %}
       {% if section.settings.enable_payment_button %}
       {{ form | payment_button }}
       {% endif %}
{% endif %}

For 3. collection page (Not perfect, cuz this will hide other product's price too T^T)

use CTRL+F to find "grid-link__meta"

you will see this 

<p class="grid-link__meta">

{%- assign price = featured.price | money -%}

{% if on_sale %}
<span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
<s class="grid-link__sale_price">{{ featured.compare_at_price | money }}</s>
{% endif %}

{% if featured.price_varies %}

{{ 'products.general.from_html' | t: price: price }}
{% else %}


{% if on_sale %}
<span class="visually-hidden">{{ 'products.product.sale_price' | t }}</span>
{% else %}
<span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
{% endif %}
{{ price }}

{%- assign variant = featured.selected_or_first_available_variant -%}
{%- if variant.available and variant.unit_price_measurement -%}
{% include 'product-unit-price', variant: variant, wrapper_class: 'grid-link__unit-price' %}
{%- endif -%}
{% endif %}

</p>

please add {% if variant.price > 0 %} right after <p> and add  {% endif %} right before </p> like what we have done before. 

you will see sth like

<p class="grid-link__meta">
{% if variant.price > 0 %}
{%- assign price = featured.price | money -%}

{% if on_sale %}
<span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
<s class="grid-link__sale_price">{{ featured.compare_at_price | money }}</s>
{% endif %}

{% if featured.price_varies %}

{{ 'products.general.from_html' | t: price: price }}
{% else %}


{% if on_sale %}
<span class="visually-hidden">{{ 'products.product.sale_price' | t }}</span>
{% else %}
<span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
{% endif %}
{{ price }}

{%- assign variant = featured.selected_or_first_available_variant -%}
{%- if variant.available and variant.unit_price_measurement -%}
{% include 'product-unit-price', variant: variant, wrapper_class: 'grid-link__unit-price' %}
{%- endif -%}
{% endif %}
{% endif %}
</p>

Hope my experience can bring you some insights and let's work hard in commerce tgt~

Have a great day:)

 

Ada

0 Likes