There are two avenue to take
- DDT aka Chemical Warfare
- Organic kitchen remidies
These methods are what I have scraped. off the internet.
1. Make the furrow in which the onion sets will be planted. Heavily dust the bottom and sides of the furrow with granulated sugar and fresh, uncooked coffee grounds. Do not stir to incorporate into soil. Plant onions. This method works for onions, radishes plus other underground root vegetables prone to root maggots.
2. Diamotaceous earth, food grade DE not pool grade, and Floating Row Cover.
3. I plant onion sets just deep enough so as the tips are sticking out of the ground. When the plants have begun to nicely established themselves, the soil is carefully pulled away to the base of the bulbs, yes some of them will then flop, though most will soon right themselves. We never again have had maggots in the onions when using this method. This also works quite well for turnips.
Beneficial Nematodes have worked for me. From 80%+ damage to 99% perfect onions. The stuff is pricy but in my area 1 treatment lasts 4 or 5 years. Works well on cabbage root maggot also.