Near-ultraviolet (near-UV) observations of WASP-12b have revealed an early ingress compared to the optical transit light curve. This has been interpreted as due to the presence of a magnetospheric bow shock which forms when the relative velocity of the planetary and stellar material is supersonic. We aim to reproduce this observed early ingress by modelling the stellar wind (or coronal plasma) in order to derive the speed and density of the material at the planetary orbital radius. From this, we determine the orientation of the shock and the density of compressed plasma behind it. With this model for the density structure surrounding the planet we perform Monte Carlo radiation transfer simulations of the near-UV transits of WASP-12b with or without bow shock. We find that we can reproduce the transit light curves with a wide range of plasma temperatures, shock geometries and optical depths. Our results support the hypothesis that a bow shock could explain the observed early ingress.