# How can I discount an inventory item?

**URL:** <https://community.glideapps.com/t/how-can-i-discount-an-inventory-item/77294>\
**Category:** Ask for Help\
**Created:** [October 24, 2024, 11:22am UTC](https://community.glideapps.com/t/how-can-i-discount-an-inventory-item/77294 "2024-10-24T11:22:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Derbis\_Bueno](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/derbis_bueno/32/81098_2.png) [@Derbis\_Bueno](https://community.glideapps.com/u/Derbis_Bueno)\
**Post date:** [October 24, 2024, 11:22am UTC](https://community.glideapps.com/t/how-can-i-discount-an-inventory-item/77294/1 "2024-10-24T11:22:52Z")

</div>

Good morning, I need your help, I have a Marketplace application, and I need that when the user completes the purchase, what he bought is discounted from the inventory after he clicks on the “Confirm Order” button at the same time that the button sends the information by WhatsApp

---

<div class="post-metadata">

**Author:** ![nathanaelb](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nathanaelb/32/43079_2.png) [@nathanaelb](https://community.glideapps.com/u/nathanaelb)\
**Post date:** [October 24, 2024, 11:24am UTC](https://community.glideapps.com/t/how-can-i-discount-an-inventory-item/77294/2 "2024-10-24T11:24:51Z")

</div>

Hello, welcome to Glide’s community forum 👋

Is your marketplace application built with Glide? Building a marketplace on Glide can be done, but it’s not necessarily a tool appropriate for an e-commerce or marketplace use case.

---

<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:** [October 24, 2024, 11:37pm UTC](https://community.glideapps.com/t/how-can-i-discount-an-inventory-item/77294/3 "2024-10-24T23:37:13Z")

</div>

> [@Derbis\_Bueno](#):
>
> what he bought is discounted from the inventory after he clicks on the “Confirm Order” button at the same time that the button sends the information by WhatsApp

I would approach it like this.

Recording Transactions:

1. Create two tables:

- Orders table
- Line Items table

1. Add a boolean field in the Orders table to indicate if an order has been processed.

Calculating Inventory:

1. In the Line Items table:

- Create a relation to the Orders table
- Add a lookup field to access the boolean from the Orders table

1. In the Inventory table:

- Create a query that links to the Line Items table
- Filter the query to show only sold items (using the boolean)
- Use a rollup to calculate the total number of items sold
- Subtract the total sold from the initial inventory to get the current stock
