Math Possible with NitroScript Variables?

Is the following possible with the right syntax?:
{product['product_weblinxcustomnumber1'] - product['product_stock']}

Basically, I need to subtract the value of product_stock from product_weblinxcustomnumber1 and “echo” the calculated value…

I’ve tried a couple different ways and have not been able to perform any math calculations… Is this possible?

Hi Derek,

The best way to do that would be to calculate the correct amount in the mappings itself.

For example you could create another weblinxcustomnumber that would contain:

stock_nm-(quantity-quantitycommitted)

And then output that custom field on the webstore.

Regards,

Peter

Gotcha. It would be really cool if we could do math with these variables. It would allow use to spare those precious few custom mappings!

Thank you for the info :slight_smile:

1 Like

Is any math possible with nitroscript variables?

NitroScript is purely a markup language with if and loop constructs.

You can often do calculations through field mappings rather than dynamically at the front-end, depending on what you’re trying to accomplish. Rules for shipping, coupon codes, etc., provide flexibility for dynamic behavior too.

We’re always happy to entertain specific requests.

Thanks for the reply Donogh :+1: