Basically, I have set a parameter called "rating" that's equal to a product.DETAILS.STAR_RATING which is a value imported from a database-driven field which happens to be a string, I want to multiply this value by 20 but since "rating" is a string I cannot multiply it.
How do I convert the string to a float value?
{% set rating = product.DETAILS.STAR_RATING %}
{{rating * 20}}
Very simple way, maybe strange but...
{% set rating = 0 + product.DETAILS.STAR_RATING %}
{{ rating * 20}}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With