I hold the PC-covers on my printer in place with normal magnets from a hardware store meant for doors. See picture. After a while the plastic started cracking, so I designed this replacement.
The magnets are 25x15x7mm : magnet with 2 iron parts on both sides and a hole through them. See picture (again)
Made for 5mm bolts.
Put the magnet in the main part and push the pin from the upper part through the magnet and the bottom. Apply some heat to melt them together.
Happy again :)