Hi @Zraszacz ,
the prices adjust automatically.
In my case all products are liquids, according to german (EU) law my base measurement unit for all products is litres (l), and my measurement unit for my products is millilitres (ml).
I have added 2 metafields for this: Grundpreispflichtig (True/False) and Inhalt (decimal). Which translates to “unit price mandatory” and “content”.
The code I use to calculate the result is the following:
{% if product.metafields.custom.grundpreispflichtig %}
Grundpreis: {{ product.price | divided_by: product.metafields.custom.inhalt | money_with_currency}}/L
{% endif %}
Which looks like this:
But if you use different base units, you could e.g. use 4 metafields base unit measure, base unit content, unit measure, unit content
and then extend the code to match your needs.
Kind regards
