Roll nests.
Or lock the birds in a shed or pen with no litter, no nestboxes, nothing on the floor at all, for about 2-3 weeks. The floor needs to be very plain with no obstacles. They will try to peck eggs but the eggs will roll away and eventually the birds will give up (for this to work the eggs can't be thin shelled). Then you reintroduce nestboxes but also change the nests so the habit doesn't return e.g. elevate them, make them darker, etc.
I reckon predators and thin eggshells are the two main reasons why chickens learn to eat their eggs. Predators break eggs in the nest and hens soon associate nestboxes with yummy treats. Thin eggshells are very easily broken and start the habit off.
Apparently lack of protein is the third common reason.
Good luck,
Erica