The accident happened in an underground car park on Leylands Road, Leeds, West Yorkshire on 31 October 2015.
Leeds Crown Court was told that the six-year-old boy and his friends were playing on the sliding gate, opening and closing it.
They pushed it beyond the retaining mechanism and, because no end stop had been fitted to the track, the gate fell over.
The boy was trapped and fatally crushed.
An investigation by the Health and Safety Executive (HSE) found Bradfabs, which had manufactured and installed the gate, failed to fit an end stop.
No one involved in commissioning or maintaining the gate over the next six years noticed or rectified the deficiency.
Bradfabs pleaded guilty to breaching s 3(1) of the Health and Safety at Work Act and was fined £30,000 and ordered to pay costs of £12,411.
After the hearing HSE inspector Julian Franklin said: “This was a tragic and wholly avoidable incident, which could have been prevented by a thorough commissioning check before handing the gate over to the building occupier.”