This is onion neck rot, a fungal disease that affects the onions while they are growing and then rots them in store.
It is most severe when onions have been grown on ground that is too rich with too much organic material that tends to make them soft.
Apply some potash to your soil and try to grow in well-drained, less rish soil and in full sunshine, with good air movement. If the soil is heavy, grow on drills to improve the drainage.
This is mainly a seed-borne disease, the spores being on the seeds and sets. You could try a different source or a seed dressing.