How to remove price and buy button on Select Products Only

New Member
2 0 0

Hi!

I am using the Debut theme and am showcasing my custom engagement rings and jewellery that are not for sale.

 

I have added them to a not.for.sale template but the price and buy buttons are still showing

 

I can remove the prices for ALL of my products but I just want to do it for my Custom pieces. 

 

Let me know if you can help. I am happy to add my Liquid code or additional information.

 

Thanks!!

0 Likes
Shopify Staff
Shopify Staff
682 40 91

Hi, @AndreaJewellery !

 

Katy here from Shopify. I hope all is well with you and welcome to our Community here.

 

I'd love to help you out with this. When you mention the not.for.sale template is this a custom template that you have created in your theme? Had you customized this too?

 

What I would suggest doing in order to set this up as you describe, is to indeed create an alternate product template. We have some info on this here, just in case you have not yet followed this guide. 

 

Then, within this template, you can hide your product prices and the 'add to cart' button by following the steps in this guide here. You could also choose to replace this button with an email link, if you liked, too.

 

Once you have this setup, you can then select this custom template within the product page to then assign it to each of these custom pieces only. 

 

09-38-zqvoh-a6tz5

 

I do hope that this helps. Feel free to let me know should you have any questions at all. 

 

Cheers,

Katy

 

Katy | Social Care @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

0 Likes
New Member
2 0 0
Hi Katy,

Thanks! I did created the template with that guide but I haven't edited it
yet because I can't figure out how to change the liquid

Here is what it looks like:

"availability" : "http://schema.org/{% if product.available %}InStock{%
else %}OutOfStock{% endif %}",
"price" : {{ variant.price | divided_by: 100.00 | json }},
"priceCurrency" : {{ cart.currency.iso_code | json }},
"url" : {{ shop.url | append: variant.url | json }}
}{% unless forloop.last %},{% endunless %}
{%- endfor -%}

What do I add to have the Price hidden?

If I use the Hide product Price guide in General it hides ALL my products
prices which is not what I want. Can I do this for JUST for that template?

Thanks!

Andrea

If I use the
0 Likes
Highlighted
Shopify Staff
Shopify Staff
682 40 91

Thanks so much for your reply, @AndreaJewellery !

 

Apologies for my misinterpretation. I now understand where you are coming from.


In this case, you will need to create both the alternate template (e.g. product.not-for-sale.liquid) and an alternate section file (e.g.product-not-for-sale-template.liquid). Here is an example of how they would look, and link together:

 

12-46-k0xcl-2w56x

 


From the code that you have shared, I am not sure if you have created both files? We will need to ensure that both files are created for this to function correctly.  Once you have these created (using the steps in this guide here) you can then hide both the 'Add to Cart' button and your pricing.


For the 'Add to Cart' Button, you will need to locate the code which manages this button and wrap it in comment tags to hide it. It will then look something like this:

 

 

{%comment%}
<button type="submit" name="add" id="AddToCart-{{ section.id }}" {% unless current_variant.available %}disabled="disabled"{% endunless %} class="btn product-form__cart-submit{% if product.options.size == 1 and product.variants[0].title == 'Default Title' %} product-form__cart-submit--small{% endif %}">
<span id="AddToCartText-{{ section.id }}">
{% unless current_variant.available %}
{{ 'products.product.sold_out' | t }}
{% else %}
{{ 'products.product.add_to_cart' | t }}
{% endunless %}
</span>
</button>
{%endcomment%}

 


Your prices, however, will be a little different, as editing your store currency settings would indeed hide the pricing for your entire store. I understand this is not what you are looking to do.


To hide pricing for certain products only, we will need to apply some logic so as to ensure it is hidden on the product page, and also elsewhere on your site (e.g. Catalog page). We will apply this in both your:

 

  • product-not-for-sale-template.liquid (Section)
  • product-card-grid.liquid (Snippet)


First, if you could create a product tag, and add this to the products for which you would like to hide their pricing. For example, a tag called: no-price.


You will need to then hop back into this alternate product-not-for-sale-template.liquid  file and search for the code which manages your pricing. In my own Debut theme (14.2.0) it is on line 118 and looks like:

 

{% include 'product-price', variant: product.selected_or_first_available_variant, product: product, show_vendor: show_vendor %}

 


Here, we can wrap this in an {%unless%} statement like so:

 

 

{% unless product.tag == 'no-price' %}
{% include 'product-price', variant: product.selected_or_first_available_variant, product: product, show_vendor: show_vendor %}
{% endunless %}


If you could then access your product-card-grid.liquid snippet, and search for the same line of code. In my Debut theme, this is at at the bottom of the file around line 47.

 


12-33-4k5ra-miwz6


You can then select this alternate file from the dropdown within each product page (admin > products).


For the line 'Tax included', if this appears for you, you can remove this by adding a 'space' in place of the text from within your theme language settings.


I hope this helps to clarify things for you, do feel free to let me know if you have any questions at all.

 

Cheers,
Katy

Katy | Social Care @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

0 Likes