I want to show what unit the price of a product is referring to e.g. Per kg, Per g, Per 250mL bottle
I don’t see any option for this when setting up my products.
I’m using Dawn theme and here is a link to one of my product pages - https://phattai.au/products/broccoli
Password: EPIQMedia
Please let me know if there is a way to accomplish this? It seems like a very simple e-commerce function so I don’t know why it wouldn’t be available.
Kani
August 17, 2022, 1:50am
2
Hi @julian-dadang
you can add unit via add metafield definition to product
Hi @Kani here is a simple guide for you. plz, explain where exactly you want to show that unit.
Thanks for that. I’m surprised that such a basic e-commerce function requires us to edit the site’s code but it achieved what I wanted so I appreciate the help
1 Like
Plz, replace the previous code with this one.
It will hide the word Per if there is no unit defined for a product
add the below code after {{ money_price }} and remove the previous one that you added earlier.
{%- if product.metafields.custom.unit %}Per {{ product.metafields.custom.unit }} {% endif -%}
Fantastic! This is great thank you.
if you want to show unit on sale items plz add the same code on below highlighted plzce in the same price.liquid file.
Sar4
July 20, 2024, 8:20am
8
Is it possible to have this on the collection pages?