There’s a few things I’ve tried in the past that work with varying levels of effectiveness.
– Cut an onion under a vent. The whole goal is to suck up as much of the escaping vapour in the air as much as posssible
– Plugging your nose with some tissue.
– Wearing swimming goggles (seriously!)
– Freezing the onion before you cut it.