How can I remove prices from a product collection and add a 'contact us for price' button?

Hello,

I have Warehouse 4.0.0 installed for my Shopify website. I am looking to remove product prices from one of my collection pages and if possible add a button below the product title with ‘contact us for prices’. I was wondering if anyone could help me remove the prices from one of my collections and if possible show me the method to add a button to contact us for price.

Collection link to remove prices from: https://www.mptreatmentuk.co.uk/collections/power-tools

Looking forward to hearing all of your recommendations.

Thank you in advance!

First, go to your Shopify admin, and navigate to ‘Online Store’ > ‘Themes’. Find the theme you’re using (in your case, Warehouse 4.0.0), click on the ‘Actions’ dropdown button, and select ‘Edit code’.

In the theme code editor, locate the ‘snippets’ folder on the left-hand side and find the ‘product-card-grid.liquid’ file, which controls the product display on collection pages.

Look for the following block of code in the ‘product-card-grid.liquid’ file:

```liquid
{% if show_price %}

{% include 'price', price: product.price, compare_at_price: product.compare_at_price %}

{% endif %}

Replace the above code block with the following code:

```markup
```liquid
{% if product.collections contains 'power-tools' %}
Contact us for prices
{% else %}
{% if show_price %}

{% include 'price', price: product.price, compare_at_price: product.compare_at_price %}

{% endif %}
{% endif %}

This code checks if the product is in the 'power-tools' collection, and if it is, it will display the "Contact us for prices" button instead of the price. If the product is not in the 'power-tools' collection, it will display the price as usual.

Save your changes to the 'product-card-grid.liquid' file.

Now, the prices should be removed from the products in the 'power-tools' collection, and the "Contact us for prices" button will appear below the product titles.

Hey @MPTREATMETNUK
Follow these steps:

  1. Go to Online Store
  2. Edit Code
  3. Find theme.liquid file
  4. Add the following code in the bottom of the file above
{% for c in product.collections %}
{% if c.handle == "power-tools" %}

{% endif %}
{% endfor %}

@Moeed The method you’ve provided can work, but it’s not the most efficient way to achieve the desired result, as it will add a style tag for every product on the page. Also, this code will only remove the price, but it doesn’t add the “Contact us for prices” button.

@MPTREATMETNUK Here’s an alternative approach using the same method

  1. Go to Online Store.
  2. Edit code.
  3. Find the ‘theme.liquid’ file and add the following code inside the <head> tag:
{% assign show_power_tools_style = false %}
{% for c in collection.products %}
{% if c.collections contains 'power-tools' %}
{% assign show_power_tools_style = true %}
{% endif %}
{% endfor %}
{% if show_power_tools_style %}

{% endif %}
  1. Locate the ‘product-card-grid.liquid’ file in the ‘snippets’ folder.
  2. Add the following code below the existing price code:
{% if product.collections contains 'power-tools' %}
Contact us for prices
{% endif %}

Now, the prices will be removed from the products in the ‘power-tools’ collection, and the “Contact us for prices” button will appear.

Hello @MPTREATMETNUK

It’s GemPages support team and glad to support you today.

I would like to give you a solution to support you.

  1. Go to Online Store → Theme → Edit code.

  2. Open your theme.liquid theme file.

  3. Add the code before tag:

{% if collection.handle contains 'power-tools' %}
      
   {% endif %}

Hope my solution can work and support you!

Kind & Best regards!

GemPages Support Team.

Hello @okur90 I have completed the first bit and have added the code into the head tag but there is no product-card-grid.liquid option in the snippets folder.

hi @okur90 product-card-grid.liquid is not an option in any of the folders on the left. Any alternative methods?

Hey @GemPages

I gave this a go but unfortunately did not change anything. Have you got any alternative methods by any chance?

product-card-grid.liquid is nowhere to be seen in snippets? Does anyone know where I can find it or know an alternative method to achieve what amendments I need to do?

@MPTREATMETNUK please check your messages, it’s working now :wink:

Hello,

With the massive help from @okur90 , managed to remove the pricing from the collection and added a ‘contact for price’ button. However, now when you go onto each product page the prices appear again. Could someone help me with the method/coding to remove the pricing from each product page in the collection?

Welcome all suggestions/ recommendations.

Thank you in advance.

@MPTREATMETNUK I appreciate your kind words. As mentioned in a private message earlier, you should add the ‘hide-price’ tags to your products, which will result in the product prices being hidden on the product pages.