Warehouse Theme - How do I hide the price of certain products

Warehouse Theme - How do I hide the price of certain products

rcohen
Visitor
2 0 0

I am using the Warehouse theme and I have some products that we want to include on our webpage, but with no pricing. We want to replace the price with the note "Contact us for price and additional information". I have searched thru the Shopify help section and the community forum and was not able to figure out what we will need to do to make this change.  I am new to Shopify and have some HTML coding experience, but no liquid coding experience and consider myself a novice.  

If able to help please let me know what you will need in order to assist.

Thank you

Shari (administrative assistant to Rob)

 

Replies 6 (6)

ProfessionalNub
Shopify Partner
101 13 30

Hi Shari

 

A good starter would be to find the product file and set a control flow tag with the condition being it outputs text (your note) instead of a price.

You'll probably need this https://www.shopify.com/partners/shopify-cheat-sheet

Hope it helps.

 

Regards,

Martin

Need help bro? I got you
Email: martinerceg@outlook.co.nz
- Website Developer
rcohen
Visitor
2 0 0

Thank you for the link to the "The Shopify Cheat Sheet - Shopify Themes with Liquid". I have seen this sheet and knew I would need it some day.

I know where to find the files, but not sure I am looking at the correct files in order to add the control flow tag to do what I need.

I was thinking the correct files are under snippets: 

  • product-item.liquid

   and or

  • product-info.liquid.

I found this coding regarding pricing within product-info.liquid (snippet section), as well as similar coding in the product-item.liquid (snippet section). Not sure if these are the correct files and I am looking for guidance on where I would need to put the control flow tag with the condition to output text (my note) instead of a price.

COPIED Coding from product-info.liquid (Theme Warehouse)

<div class="product-item__info">

    <div class="product-item__info-inner">

      {%- capture price_list -%}

        <div class="product-item__price-list price-list">

          {%- if product.price < product.compare_at_price -%}

            {%- if product.price_varies -%}

              {%- capture price_min -%}<span>{{ product.price_min | money_without_trailing_zeros }}</span>{%- endcapture -%}

              {%- capture price_max -%}<span>{{ product.price_max | money_without_trailing_zeros }}</span>{%- endcapture -%}

              <span class="price price--highlight">{{ 'collection.product.from_price_html' | t: price_min: price_min, price_max: price_max }}</span>

              <span class="price price--compare">{{ product.compare_at_price_min | money_without_trailing_zeros }}</span>

            {%- else -%}

              <span class="price price--highlight">{{ product.price | money_without_trailing_zeros }}</span>

              <span class="price price--compare">{{ product.compare_at_price | money_without_trailing_zeros }}</span>

            {%- endif -%}

          {%- elsif product.price_varies -%}

            {%- capture price_min -%}<span>{{ product.price_min | money_without_trailing_zeros }}</span>{%- endcapture -%}

            {%- capture price_max -%}<span>{{ product.price_max | money_without_trailing_zeros }}</span>{%- endcapture -%}

            <span class="price">{{ 'collection.product.from_price_html' | t: price_min: price_min, price_max: price_max }}</span>

          {%- else -%}

            <span class="price">{{ product.price | money_without_trailing_zeros }}</span>

          {%- endif -%}

        </div>

Hoping for a little bit more guidance.

 

Thank you 

Shari for Rob Cohen

 

ProfessionalNub
Shopify Partner
101 13 30

What I would do is create a product tag called nopricing and assign it to products, so that in code it'll find a match and can printout your designated text.

So something like this

{% assign foundtag = false %}
{% for tag in product.tags %}
{% if tag == "nopricing" %}
{% assign foundtag = true %}
{% endif %} {% endfor %}

{% if foundtag %}
PRINT OUT YOUR TEXT HERE
{% elseif %}
{% if product.price < product.compare_at_price %}
.....
{% endif %}
{% endif %}

You can probably reference the cheat sheet to guide you through what I've used. If this doesn't work I suggest inspecting the browser and looking for where the pricing is and applying a similar way to how I wrote the code above.

Need help bro? I got you
Email: martinerceg@outlook.co.nz
- Website Developer
APG-David
Explorer
62 4 23

wait.. couldn't the original poster just "comment out" the code that displays the product price?

Using.. { %comment} and { %endcomment}?

 

And where would they do either of these solutions? in the snippet? or in the item code? or both?

APG-David
Explorer
62 4 23

No answers? Its been more then a week. Okay. I'll do what I can to find the answer and I'll report back.

APG-David
Explorer
62 4 23

OK everyone... I found a way to do MOST of what I.. and the OP wanted to do. 

The solution that has been offered. Is a good one. 

HOWEVER.. if you are using a sectioned theme. AND you are using VARIANTS. It won't work for you.

You won't find "product.price" or "product.compare_at_price" because those terms were replaced by the coding for the variants you chose to use. 

 

I figured that out by going through every.... single... line of code in the product snippet I had set up for the website I manage. 


So, long story short. Because I wanted to hide the price AND the variant information of the product template for a particulare collection. I ended up having to go into that template, hunting down the specific code, and stripping it out. 

 

It works. I'll post my own thread on what I did and how YOU can do the same if you want similar results.