Stop Windows 10 from using the UEFI preinstalled serial key

I came across an issue with upgrading a Win 10 Home laptop to Pro.
The issue was that no matter what I tried, typing in a Pro product key, installing from a Pro image, it re-installed the Home version which then refused to upgrade.

I realised that the windows key is stored in UEFI and the install was using this every time. The key was for the home edition.
It seems you can't remove or switch off or disable this key.

This is how to override the UEFI key:

First of all, make sure you have a regular (single-architecture) Windows ISO.
Then, try this method:

Create a Setup USB drive
Create a file named PID.txt in the Sources directory, with the following contents:

[PID]
Value=XXXX-XXXX-XXXX-XXXXX-XXXXX
Boot from this USB drive

I used the generic upgrade key for Win 10 Pro. As the user had a valid licence via Microsoft365 for Windows 10 Pro this was ok to use for the install.
Generic upgrade key: VK7JG-NPHTM-C97JM-9MPGT-3V66T

Problem solved!