Doing math with data results

I am setting up my shop (well trying to :slight_smile:)

In my products table, I have the following:

  • Product ID
  • Product Name
  • Product Price
  • Product Description
  • Product Image
  • Credit Card % (foreign key)
  • Processing Fee (foreign key)
  • Shipping Fee (foreign key)

The foreign keys link to a separate shipping table that contains their values. I choose to do a separate table because the amounts may vary depending on product category and product type. The amounts may vary during different times of the year as well.

What I need to do is this:

(Product Price + Processing Fee + Shipping Fee) = A
(A * Credit Card %) = B
(B + Processing Fee + Shipping Fee) = S&H Subtotal
(Product Price + S&H Subtotal) = Total Price

And on the website display the results:

Product Price…S&H Subtotal…Total Price

Is this possible in Wappler or should it be done in mySQL through a view?

1 Like

This is possible in Wappler, this is Brian’s (@Hyperbytes) way of doing this https://docs.wappler.io/t/ecommerce/7728

I prefer to use session storage as per Using Session Storage Keyed Array with the following result