This issue could be caused by a few things, without seeing your actual code it's difficult to determine exactly what might be happening but here's some thing you could do to troubleshoot further:
Check Synchronization: Ensure that your code correctly synchronizes changes between parent and child products. This might involve listening for changes to the parent product and then applying the same changes to the child products.
Check API Calls: Check that your API calls are correctly formatted and that they're correctly updating the quantities of the child products. It's possible that there's an error in your API calls that's causing the incorrect item count.
Concurrency Issues: If multiple operations are being performed at the same time (for example, if you're increasing the quantity of the parent product while also adding a new child product), this could lead to concurrency issues. You might need to implement some form of locking or transaction control to ensure that operations are performed in the correct order.
Database Issues: If you're storing product information in a database, there could be an issue with how this data is being updated or retrieved. Check your database queries to ensure they're correctly updating and retrieving product quantities.
Look into the above things and if you're still running into issue let us know!