Hall sensor: £15 Part No. 54 34 7 190 735 bought directly from BMW (just pretend you have a 1 series convertible to get to checkout).
Connector pins: £2.50 Part No. 61131393723 I bought them from ebay but I'm sure you can get them from elsewhere.
Connector block: £3? Part No. 8373575-02 I personally reused the one that came off the old part, but one can be bought from aliexpress with a pretty long delivery time, however it means you can just do a straight swap when the part arrives.
After that you just need cut the wires to the correct length, strip the cable, crimp the connector pins to the cable, put the pins into the connector block, then put the part back into the car. It's fiddly, but I found it could be done in place without having to remove anything.
https://www.sytnerstevenagebmwparts.co.uk/p/Bmw__/Hall-sensor/132266649/54347190735.html