We study the effect of a magnetic field on Goos-H\"anchen shifts in gaped graphene subjected to a double triangular barrier. Solving the wave equation separately in each region composing our system and using the required boundary conditions, we then compute explicitly the transmission probability for scattered fermions. These wavefunctions are then used to derive with the Goos-H\"anchen shifts in terms of different physical parameters such as energy, electrostatic potential strength and magnetic field. Our numerical results show that the Goos-H\"anchen shifts are affected by the presence of the magnetic field and depend on the geometrical structure of the triangular barrier.