For latch itself, I used a piece of wood ( 20mm x 20mm x 300mm ), held by 6mm furniture screw.
To hold latch in upper position I used magnet ( diameter 10mm ; height 2mm) in printed magnet holder.
Printed using Prusament PETG on my Prusa Mini+ - no supports needed. (Used default "0.20 Quality" + 30% infill + 3 perimeters setting in PrusaSlicer)
The author marked this model as their own original creation.