# Adding Multiple Products to an order

**URL:** <https://community.glideapps.com/t/adding-multiple-products-to-an-order/73378>\
**Category:** Ask for Help\
**Created:** [May 14, 2024, 8:26pm UTC](https://community.glideapps.com/t/adding-multiple-products-to-an-order/73378 "2024-05-14T20:26:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nathan\_M](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathan_m/32/43901_2.png) [@Nathan\_M](https://community.glideapps.com/u/Nathan_M)\
**Post date:** [May 14, 2024, 8:26pm UTC](https://community.glideapps.com/t/adding-multiple-products-to-an-order/73378/1 "2024-05-14T20:26:56Z")

</div>

Hi guys!

I’m building an app that allows customers to place orders for items.

Where I currently stand:  
By leveraging a few existing templates I’ve hacked together the ordering process in entirety for a SINGLE product. (It works)

I am however stumped on how to get users to add MULTIPLE products to a SINGLE order, while still providing total values and updating the stock levels.

My current tables are as follows:

- User
- Category
- Products
- Orders

Additional details:

Customer:  
A user can: add multiple products to an order  
A user can: add multiple quantities of each product to an order  
A user can: place an order, see their basket and total price (standard checkout)

Admin/Shop owner:  
A user can: see submitted orders and all the relevant details

Do I need to create a cart table? I would love some insights here please on how to get this working or if there are some existing examples.

Thanks!

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [May 15, 2024, 1:55am UTC](https://community.glideapps.com/t/adding-multiple-products-to-an-order/73378/2 "2024-05-15T01:55:17Z")

</div>

I used to create a Cart/Order Line table for use cases like this. You tie the order ID with the multiple order lines.

---

<div class="post-metadata">

**Author:** ![Nathan\_M](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathan_m/32/43901_2.png) [@Nathan\_M](https://community.glideapps.com/u/Nathan_M)\
**Post date:** [May 15, 2024, 4:23pm UTC](https://community.glideapps.com/t/adding-multiple-products-to-an-order/73378/3 "2024-05-15T16:23:52Z")

</div>

> [@ThinhDinh](#):
>
> Cart/Order Line table fo

Thanks for this.

How does this work in practice? I’m a bit of a noob here.

---

<div class="post-metadata">

**Author:** ![\_eric](https://avatars.discourse-cdn.com/v4/letter/_/5f9b8f/32.png) [@\_eric](https://community.glideapps.com/u/_eric)\
**Post date:** [May 15, 2024, 10:09pm UTC](https://community.glideapps.com/t/adding-multiple-products-to-an-order/73378/4 "2024-05-15T22:09:04Z")

</div>

You will also want to map out how to clone an order and it’s associated products.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [May 15, 2024, 11:31pm UTC](https://community.glideapps.com/t/adding-multiple-products-to-an-order/73378/5 "2024-05-15T23:31:11Z")

</div>

The flow would look like this, assuming your users are signed in:

- Add a Cart table that would contain the order id, the item id and the quantity.
- In your users table, add a “current order ID” column.
- Assuming you have an Items screen, on the entry to the details view of that screen, check if your “current order ID” is empty. If empty, set a unique ID to the “current order ID” column, then show them the details screen. Else just show them the details screen without doing anything.
- Add a form inside each item’s details screen, allow users to set a quantity and write to the Cart table: the “current order ID”, the “item ID” and the quantity.
- Add a Cart screen that uses a relation of “current order ID” to show items that have been added to the cart. You can leverage that relation to calculate the total cost of the order.
- Add a submit order button that writes a row to the Orders table that contains the “current order ID”, and set a new unique ID to the Users table preparing for the next iteration.

---

<div class="post-metadata">

**Author:** ![Nathan\_M](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathan_m/32/43901_2.png) [@Nathan\_M](https://community.glideapps.com/u/Nathan_M)\
**Post date:** [May 21, 2024, 7:29pm UTC](https://community.glideapps.com/t/adding-multiple-products-to-an-order/73378/8 "2024-05-21T19:29:57Z")

</div>

Thanks @ThinhDinh, it took me a while to figure out because I overcomplicated my DB but your explanation makes complete sense and worked out in the end (I had to create a new file to run through your process without my overly complex DB)

Cheers!

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [May 21, 2024, 11:07pm UTC](https://community.glideapps.com/t/adding-multiple-products-to-an-order/73378/9 "2024-05-21T23:07:53Z")

</div>

Great to hear! Let me know if you need anything more about this.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [May 28, 2024, 11:07pm UTC](https://community.glideapps.com/t/adding-multiple-products-to-an-order/73378/10 "2024-05-28T23:07:57Z")

</div>

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