Shopify themes, liquid, logos, and UX
Hello,
I need to remove the decimals of the price on the product page. So "45,-" instead of 45,00. I only want to do this on some of my product templates and not the whole store. So preferably with custom css on the product page it self. Theme code could also be an option, but not prefered.
Alternatively it could be an option to use superscript to do this. Can that be done with (custom) css?
Thanks!
Hi,
This can not be done purely with css
To change the format of prices for some products you need to modify the code that is displaying prices on product page and add some conditional logic to modify the price format for some specific products
Ok clear. Is there any possibility that you can provide an example code ?
Thanks,
Sure I can provide you a sample code
{% if template == 'your-special-product-template-name-here' %}
{% assign product_price = product.price | divided_by: 100 | round %}
{{ product_price | money_without_trailing_zeros }}
{% else %}
{{ product.price | money }}
{% endif %}
Thank you, so i must place this in the price.liquid? I'm using the Expanse theme.
But i'm not able to get this to work... For now i want to use it in the standaard product template > which name should be "product" > but how can i double check that?
Hi,
If you want me to further look into this I need to view your theme files and complete guideline on "for which specific products you want to apply this"
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024