Hello guys,
I want to do this math tasks with this fields in custom liquid:
{{product.metafields.custom.markenpreistest | metafield_text}}
minus
{{product.price | money}}
how i have to write the code, so this works?
A user seeks help performing mathematical calculations using product metafields in custom Liquid code. Specifically, they want to subtract a metafield value (markenpreistest) from the product price and display the result in a money format.
Proposed Solution:
metafield_text filterminus filtermoney filterAdditional Context:
Another participant references their approach for complex calculations involving custom sizes and prices, mentioning a square meter calculator example, though the specific implementation details and link appear corrupted in the thread.
The discussion remains technical and focused on Liquid syntax for metafield arithmetic operations.
Hello guys,
I want to do this math tasks with this fields in custom liquid:
{{product.metafields.custom.markenpreistest | metafield_text}}
minus
{{product.price | money}}
how i have to write the code, so this works?
{% assign markenpreistest = product.metafields.custom.markenpreistest | metafield_text %}
{% assign price = product.price | money %}
{% assign result = markenpreistest | minus: price %}
The result is: {{ result }}
This solution is how we do complex calculations for adding custom sizes and prices.
This this example where we have a square meter (sq/m or sqm calculator) or calculate price by length calculator.