Plus math sign (+) in expression don't work

Hi to all,
i’m tring n8n on a self hosted server and work very well.
So i’m setting my workflow to import order from a WooCommerce installation to a CRM with a PUT http request. So, i wanna ask you if there is a official guide to use if/else in the “expression” editor of the HTTP node or function node. Also i have a problem, when i use “plus” (+) math sign to the expression section of the nodes it don’t work, but minus, divide or multiplicate yes. Whats is the problem? Can you help me, thank you.

Hi @Giorgio, welcome to the community!

Chances are one of your values is a string. Could you try wrapping the values you are adding in parseFloat() (MDN) so you have something like {{ parseFloat( $node["WooCommerce"].json["total"] ) + parseFloat( $node["WooCommerce"].json["total_tax"] }}?

As for a general overview of expressions, check out our docs.

3 Likes

can also simply use an extra + in some cases.
so +total + +total_tax it would convert string to a number. Not sure about decimal formatting and such

3 Likes

Thank you, i have solved with the “parseFloat” solution :slight_smile:
do not had tried the “++” solution but the first one work.

1 Like

Awesome, glad to hear this works. Thanks so much for confirming!