Stape Store Margin Lookup Variable Template Issue

Hi @Alex @Dan

I’m using the Stape Store Margin Lookup Variable template to extract the profit value from the store based on the items parameter in the event data. It is working well. The profit is correctly calculated for all items in the purchase event.

However, the output is showing up like this: 69.94999999999999. I would like the final result to be rounded to 2 decimal places, such as 69.95.

I’ve managed to fix this by modifying the template’s source code, BUT I’d prefer not to tamper with the original variable code.

So, is there a any way to round the output to 2 decimal places without modifying the template source code?

Also what if someone uses a discount code? Will the variable take that into consideration? If not then how can I handle this?

Thanks in advance for your help!

Hi @Alex
Would you please shed some light on this? I’d really appreciate. Thanks.

Hey @Md_Monirul_Islam
I think the simplest option here is to add a fix to the template.
I have asked my colleagues to implement this on our side as well.

1 Like

Thank you so much. Could you please give me some guide about this?

Hi @Md_Monirul_Islam, the rounding option has just been added to the template. You should receive the update notification soon.

Also what if someone uses a discount code? Will the variable take that into consideration? If not then how can I handle this?

Currently, the variable doesn’t account for this case.
An option would be to use another template (the Math variable) to subtract the discount value from the value returned by the Stape Store Margin Lookup variable, or we could add a new field to the template where the user can input this, and it would take care of doing that (however, this could make the value to be negative).

1 Like

Awesome!! Although I’ve already modified that variable because I needed to submit the project and it’s working good. But thank you so much. I’ll use the updated version.

This is a time saver man!! I thought I need to create a variable for the calculation. :smiling_face_with_three_hearts:

This would be a great feature. My client is already planning to send profit for another two projects for POAS bidding strategy. I asked about the negative value but he said it would okay for him. Really looking forward to using this feature.

Thank you so much for your help. Really appreciate it .

1 Like