Get lots of pot eggs and put them in the coop and nest boxes. They will knock themselves silly trying to get into them and that breaks the habbit- they remember the headache I suppose.
We've just dealt with the same problem in this manner. Starts when an egg gets broken and leads on from there, so collect the eggs regularly during the day to keep the nest boxes free.