Change total quantity in invoice using custom field

I created a custom field in the child table named “free”, which indicates the quantity I want to give free.

How can I now change the total quantity, i.e., add the free in total quantity so that it reflects in the stock and bill?

For eg., If I’m selling 15 items and giving 1 free, then total quantity should be 16 in the bill and 16 units should be removed from the stock.

The total quantity and weight should change to 16 and 320 respectively, and the free should also reflect back in stock. But it should not change the price.

Or is there any way to create free schemes (like 1 free on 14) without making new row?