07-31-2023 05:34 AM - edited 07-31-2023 06:06 AM
Hi community!
I'm currently in the middle of creating in-app messages using personalization with custom attributes. One of the attributes is a number that is divided by a point, e.g. 500.90, as in 500.90$. Since I am in Germany and we use commas as decimal points, I was wondering: Can I use Liquid in order to swap the point with a comma?
Looking forward to your tips and tricks!
Have a good week everybody 🙂
Stella
Solved! Go to Solution.
07-31-2023 03:59 PM - edited 07-31-2023 04:03 PM
Hey Stella - you should be able to handle this with the replace filter, and {{custom_attribute.${your_attribute} | replace: ".", "," }}
My test example:
Set values:
{% assign amount = 500.90 %}
{% assign amount2 = amount | replace: ".", "," %}
Print results:
amount: {{amount}}$
amount2: {{amount2}}$
Output:
amount: 500.9$
amount2: 500,9$
07-31-2023 03:59 PM - edited 07-31-2023 04:03 PM
Hey Stella - you should be able to handle this with the replace filter, and {{custom_attribute.${your_attribute} | replace: ".", "," }}
My test example:
Set values:
{% assign amount = 500.90 %}
{% assign amount2 = amount | replace: ".", "," %}
Print results:
amount: {{amount}}$
amount2: {{amount2}}$
Output:
amount: 500.9$
amount2: 500,9$
08-01-2023 01:43 AM
Hi Nathan, amazing, that worked for me as well! Cheers