I want to do some math in twig. I've got 2 variables, price and quantity and i want to multiply them. But when I do it like this:
{{ {{ carts.price }} * {{ carts.quantity }} }}
It returns an error
A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "punctuation" of value "{".
How can i do this
It's because you duplicate {}, try something like this :
{{ carts.price * carts.quantity }}
some docs https://twig.symfony.com/doc/2.x/templates.html#math
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