Tax Codes (NIF) and how to get one in Portugal as a non-resident

Hi there everyone
I am new to the Nomad/Gate community and apologise if this topic is already covered.
I am based in New Zealand and with my wife we want to buy a modest Central Portuguese house for later in my and her working life.
Getting a NIF (tax code) seems somewhat difficult if you live overseas, and expensive. My question is that it appears some advice says that you cannot do an online application unless it relates to a business application but then I saw that a ‘Nomad’ had suggested that a cheaper version was possible…OR should I use our relative in Portugal who can apparently do it cheaply and in person over there (with our scanned documents). Any feedback would be fantastic.
Have a great New Year everyone wherever you maybe!
Thanks
Mark

A couple of topics here about NIF that you can check out: