How to Update Quantity of Existing Product in Shopping Cart with Mendix?

Hello everyone, I'm currently working on a shopping cart feature in Mendix where users can add products to their carts. However, I'm facing an issue with updating the quantity of existing products in the shopping cart. Here's the scenario: when a user adds a product to the cart that is already present in the cart, I want to update the quantity of that product instead adding the chosen quantity to item in the cart. However, I'm struggling to implement this logic effectively. Could someone please provide guidance on how to achieve this in Mendix? Specifically, I'm looking for advice on how to update the quantity of an existing product in the cart when the same product is added again. Any insights or suggestions would be greatly appreciated. Thank you!
1 answers

The issue seems quite simple but the question is which associations between entities you use and how.

One of the simplest ways would be to use a microflow with a decision object ("if the shopping cart contains a product increase the number of products") .

Or even simpler in a microflow to always add the number of items - if it is 0 then the proper number of products will be added.

It all depends on the logic you have in use for now, but if you are using an entity that contains the number of products and is an association between the shopping cart and the number of products then the case is already simple