If you like, you can skip directly to where you can buy this part.
It’s easier to remove the hood latch on an E30 if you first remove the driver side grille, but it’s not essential.
Two 10mm bolts attach the latch to the body of the car. Once removed, you open the hood and work the latch out of its location into freedom by wiggling it past the headlamp.
If the latch is broken so you can’t open the hood, you can often get it to open by inserting a Philips screwdriver into the hole in the latch, and pressing in hard. You would insert the screwdriver from the front so that the tip points to towards the rear of the car.
Once you have the latch out in the open, you can use a screwdriver to pry the plastic cover off and then work the cable loose.