Hello all,
I am trying to create a marketplace with cart type(table) and shopping cart type.
After adding products to the cart, I need to add reference data from the cart to the shopping cart type in order to use the Total price stored in the Total cost field in shopping cart type to appear in the design.
Tow image below is about workflow after clicking on the cart button.
You add the cart item to the cart whenever a new ‘item’ is added to the cart (sounds obvious when you say it out loud).
Usually, the cart item would include a sub-total, which would be the price of the product multiplied by the quantity…
But if only a single of each item can be added to the cart then there’s no need for that… (you don’t have it in your database, so I assume that’s the case for you?).
To calculate the Total cost of the cart, just :sum the sub-totals of the cart items.
You can do that just on the page to display the total cost, or you can do it in the database anytime a new cart item is added to the cart (just update the Total to be the sum of all cart items, including the newest one).
I might be looking at your workflow incorrectly, but you seem to be creating a new shopping cart for every cart item, and/or every cart item has it’s own shopping cart?
Which I’m guessing is not what you’re trying to do? (or is it?)
Or is the workflow in your screenshot only for the very first item added to a cart?