Hide unit price on collection

Hide unit price on collection

HelplessSoul77
Excursionist
28 0 11

Hello, 

 

I use Dawn 14.0.0. 

I would like to show unit price (€/kg) only on product page, but not on any of featured collections and collection pages. 

Any idea how to do that? 

 

Thank you. 

Replies 13 (13)

topnewyork
Globetrotter
633 114 134

Hi @HelplessSoul77 , kindly share your store URL please. Thanks!

Need a Shopify developer?
Hire us at Top New York Web Design
For Shopify Design Changes | Shopify Custom Coding | Custom Modifications
Subscribe to our youtube channel

Tech_Coding
Shopify Partner
337 93 84

Hello @HelplessSoul77 

would you like to share your store URL and password if any please.
so i can check and provide you possible solution for your question.

my reply helpful? Click Like to let me know!
your question answered? Mark it as an Accepted Solution.
Shopify UI Developer
Your Coffee Tips adds a little sweetness to my day.

topnewyork
Globetrotter
633 114 134

@HelplessSoul77 , 

 

1. Go to Online Store -> Theme -> Edit code.
2. Open your theme.liquid file
3. In theme.liquid, paste the below code before </head>

 

{% unless template == 'product' %}
  <style>
    .unit-price {
      display: none;
    }
  </style>
{% endunless %}

 

If my reply is helpful, kindly click like and mark it as an accepted solution.

Thanks!

Need a Shopify developer?
Hire us at Top New York Web Design
For Shopify Design Changes | Shopify Custom Coding | Custom Modifications
Subscribe to our youtube channel
HelplessSoul77
Excursionist
28 0 11

It doesn't work. It does nothing actually. 

topnewyork
Globetrotter
633 114 134

@HelplessSoul77  Try the below:

{% if template == 'product' %}
<style>
.unit-price {
display: none !important;
}
</style>
{% endunless %}

Need a Shopify developer?
Hire us at Top New York Web Design
For Shopify Design Changes | Shopify Custom Coding | Custom Modifications
Subscribe to our youtube channel
HelplessSoul77
Excursionist
28 0 11

This code is invalid. 

topnewyork
Globetrotter
633 114 134

@HelplessSoul77 , 

 

1. Go to Online Store -> Theme -> Edit code.
2. Open your theme.liquid file
3. In theme.liquid, paste the below code before </style></head>

{% if template == 'product' %}
.unit-price {
display: none !important;
}
{% endif %}

I've check this code and it is working.

If my reply is helpful, kindly click like and mark it as an accepted solution. 

Thanks!

Need a Shopify developer?
Hire us at Top New York Web Design
For Shopify Design Changes | Shopify Custom Coding | Custom Modifications
Subscribe to our youtube channel
HelplessSoul77
Excursionist
28 0 11

"unless" keyword is used incorrectly as it doesn't have a corresponding opening tag in your code

topnewyork
Globetrotter
633 114 134

Sorry, there was a glitch during the code writing. I've edited the above reply. Please check it now.

Thanks for your cooperation.

Need a Shopify developer?
Hire us at Top New York Web Design
For Shopify Design Changes | Shopify Custom Coding | Custom Modifications
Subscribe to our youtube channel
HelplessSoul77
Excursionist
28 0 11

Ok, I used the correct code, but it still doesn't work. Prices per unit are still shown on all featured collections and collection pages. 😞

topnewyork
Globetrotter
633 114 134

@HelplessSoul77 , try both below codes one by one if any works then please like this and mark this as an accepted solution.

 

{% if template == 'product' %}
.unit-price {
display: none !important;
}
{% endif %}

 

OR

 

{% if template == 'product' %}
<style>
.unit-price {
display: none !important;
}
</style>
{% endif %}

 

Need a Shopify developer?
Hire us at Top New York Web Design
For Shopify Design Changes | Shopify Custom Coding | Custom Modifications
Subscribe to our youtube channel
HelplessSoul77
Excursionist
28 0 11

It seems to me you're very distracted by something because your second code is invalid again. 
I changed it to 

 

{% unless template == 'product' %}
<style>
.unit-price {
display: none !important;
}
</style>
{% endunless %}

 

Either way, none of your two proposing solutions work. 

HelplessSoul77
Excursionist
28 0 11

I can't locate 

 <!-- Your unit price code here -->