Maybe in your case it is helpful to implement the concept of dynamic forms mentioned in the docs here. With dynamic form behaviour, you can ask for further details (size and quantity) based on how a previous slot was filled (cookie).
So, in this case you would use 1 form and if a slot is filled with cookie then you would ask for slots size and quantity to be filled too. Then the same if slot coffee is filled.