Add to Cart System

Hello! I want to ask for some help.

I want to do it where if I click the Add to Cart button, the product, with this detail:

Hazelnut, P30 x 5..................................P150

(Please ignore the .........., it should be a space) This should appear below. Since it is like a Bill. It should handle multiple text since the user will pick the item/s they want to add in the cart.

Then the Total Amount of Products, the Amount the Customer Pay and the Change should also appear below the List.

Then the stocks of each product should also be subtracted/updated.

I think I will be creating a new list for the AddToCart, but I do not know how I can make the bill/list part. Also the Total Amount to pay, the Amount the Customer Paid, and also the Change.

How can I do it?

This is the system. The bill should appear below:

This is my Blocks:

Thank you very much.

You could start here for how to build a cart.

It covers how to add up costs and get to a total cost.

It also does not make change. (I don't know how your local currency works.)

It does not cover inventory.

That would require an extra TinyDB Inventory NameSpace with product as tag and quantity in Inventory as value.

1 Like

this app is for only one person? or multi users?
normally we need tables like users, products, stocks, orders, carts...

one person only

You can use @ABG 's sample, use many namespace to store data.

or you can use just one namespace, and store all data list in several tags.
In your blocks, you already have a prodList, then add some more like stocks/ carts/ orders.

then it's only some work to operate the lists (add, remove, replace, select).
everytime you changed the list, remember to save it to tinyDB.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.