I think that the way you have your shopping cart setup might be creating the issue for you. Right now, you are adding the drink to the shopping cart in the list, but what happens when a customer selects two different drinks with different prices and different quantities? To do this effectively, you need to add another table in your database that captures all the information to make that calculation.
Create a new table called line item. Give it the following fields:
Drink (the drink type thing)
Quantity (Number)
Price (Number = price for each drink)
Line Item Price (number = quantity x price)
Shopping Cart (the shopping cart type thing)
Add a list of line items to the shopping cart. Now, when the customer adds a drink to their shopping cart, create a line item and add it to the Shopping Cart’s list of line items. When you are adding that line item to the shopping cart, you can update its cart price and quantity numbers with the following:
Thank you for responding to me. I have tried to follow your steps… however I am still having an issue getting the price information to be calculated based on quantity and price into a grand total.
Look at the step where you are creating the new line item. Look at the field for Line Item Price. You are saving the item price twice, but in this field you need to change it so that it is the following:
Current cell’s Drink’s Drink Price * Quantity Input’s Value
Then in the shopping cart thing in your database, make sure that you have a List of Line Items field that you add all the line items too. Then for the shopping cart, you can use the following to calculate your cart total:
Shopping Cart’s List of Line Items’s Line Item Price:sum
You can then format it to currency or however you want to display it.
Can i just say you have helped me massively. I have managed to successfully do the first part of your advice. and now I am getting a grand total displayed in my database.
However, I am still having trouble adding the Data to the shopping cart so that it can be displayed in the grand total.
Please find attached some pictures of the areas I think I’m going wrong. The highlighted Yellow captures the successful calculations
Okay, so looking at what you got in the pictures, these could be possible causes for you:
In the first picture, make sure that the “line items” field is a list of line items, then it should be set to “add” result of step 1.
Is the second picture, you will need to add a step 3 that makes a change to result of step one. The only field changed would be the shopping cart and it will equal result of step 2.
For the last picture, I would recommend unchecking “Enable auto-binding on parent element’s thing”. You can keep this as an input, but a text element would word well as you don’t want your users changing this. Where you have the placeholder, you need to change it to “Parent group’s Shopping Cart’s line items:sum” or if you have a total price field on the shopping cart, use that one.