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.
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.
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.
@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.
@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.
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.
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.
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.