Shopify themes, liquid, logos, and UX
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.
Hi @HelplessSoul77 , kindly share your store URL please. Thanks!
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.
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!
It doesn't work. It does nothing actually.
@HelplessSoul77 Try the below:
{% if template == 'product' %}
<style>
.unit-price {
display: none !important;
}
</style>
{% endunless %}
This code is invalid.
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!
"unless" keyword is used incorrectly as it doesn't have a corresponding opening tag in your code
Sorry, there was a glitch during the code writing. I've edited the above reply. Please check it now.
Thanks for your cooperation.
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. 😞
@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 %}
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.
I can't locate
<!-- Your unit price code here -->
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024