The part of the onion we generally eat is either part of the root or part of the stem. Humans do not typically eat the fruit of an onion.
If you grow some onions at home and leave it until next year, then the plant with flower and if fertilized, it will create seeds. The seeds are small and not particularly appealing. I have not tried tasting them, so I can’t help you figure that out. After fruiting, the onion will have used up the resources it stored in the bulb and will die.