Here's what I came up with to keep toddlers out: Drill 3/8" holes all the way through each shelf other than the bottom one (90 degree bit adapter may be required, bottom shelf is drilled out only like 1/4 of the way through), insert a 1/4" steel rod into the holes, add a locking hasp on the top of the unit that when locked, will block the steel rod from being removed. Better looking and more secure than the pipe thing IMO.
https://imgur.com/a/C1sL5P9