Shopify Dawn Theme Hide Product Price On Search Page

Hello,

EDIT: use @kazi_1 solution below to avoid any issues with other templates.

I could not find a quick answer on how to hide the product price from search results page on Dawn theme. To hide the price on the search results page, just add the following css to main-search.liquid right above the closing style tag .

.price-item {
display:none !important;
}

I couldn’t easily figure out how to hide the price within the liquid code in the product card. My reasoning for hiding was it was only showing the “From” price and I wanted it to show from-to price. Much easier just to hide the price.

Hope this helps!

@shadowsfall118 go to Assets > base.css put this css at bottom

.template-search .price {
    display: none;
}

@kazi_1 That works too. Any difference between your solution and mine?

If yours one works you can use it no problem, the search result products templates are common with normal collections so if you hide by common price div it will be hidden from everywhere, if you use mine it will be hidden from only search results

@kazi_1 thanks for the explanation. Although the css within the main-search.liquid file should only execute when the search page is used. In my opinion both are acceptable. If you find otherwise please let me know and I’ll switch to your suggestion.

@kazi_1 do you know which templates utilize the main-search.liquid?

card-product.liquid for products

@kazi_1 thanks. I marked yours as the solution to avoid any issues.

@shadowsfall118 you welcome

Is it possible to do this for only a specific product template? I’ve created a couple and only want to hide the price on one of the product templates? I got it to hide on the product page but would like to hide the price of that collection on search as well as the collection pages/home page.

I believe you would need to wrap it inside an if statement.

So if you go back to my original suggestion you would add the below code right above the closing style tag

{% if template contains ‘product’ %}

.price-item {
display:none !important;
}

{% endif %}

There is no closing style tag in base.css right? It would be under the product template liquid?

@abaker11 inside the desired .liquid file try adding the following under the last “asset_url |stylesheet_tag” for the CSS (ex. {{ ‘component-loading-overlay.css’ | asset_url | stylesheet_tag }}) and not the .css file.

{% if template contains ‘product’ %}

.price-item { display:none !important; }

{% endif %}

Replace ‘product’ with the name of your template. As kazi mentioned this may effect other templates so test all your pages. I’m suggesting this way because I don’t believe you can use liquid code inside CSS files.

I have not tested so please experiment.

@abaker11 There are also two better ways to hide the price on your product template if you are using the latest dawn or 2.0 version.

Option 1 is to login to your admin and click on the online store then customize. In the top middle drop down click products and then go to the desired product template. On the left just delete the price, quantity and buy button blocks.

The second option is to wrap the price elements inside the main-product.liquid file with the if statement {% if template contains ‘product’ %}. Below is an example of where to do this with the dawn template.

Screen Shot 2022-03-31 at 8.58.16 AM.png

I would go with option one. I assume you’re talking about the product page and not the search page as this thread was in relation to the search results page.

Hope this helps.

Hello,

I’ve removed the price from the product page before the post but for the same product, it still shows the price on the search page and on home page and collection pages. That is the issue im facing. I don’t want it to show anywhere if I already hid it on the product page but I only want this to apply to the specific collection where I hid the price on the product page.

@abaker11 I get it now. Thanks for the explanation. There is no straightforward solution using these methods. Firstly you’re saying that kazi’s solution is not working for your search page? I can confirm it works for the dawn theme.

For the other areas (collections and home pages) you will have to use the browser inspector to track down each element’s name and then trace that name inside each correct liquid template and wrap those elements in if statements.

Try following this tread too:

https://community.shopify.com/c/shopify-design/hide-prices-of-products-in-a-collection/td-p/499258

Sorry I can’t help any further. I think I set you on the right track.

Okay thanks for the help. Kazi solution does work but it removes it from all products not just the specific collection I want. Appreciate the help and I will keep looking into this.

Is there a way to implement the price not being displayed in search results but only for products with specific tag?