Link your Origin Account then Goto: [ %localappdata%\GOG.com\Galaxy\plugins\installed ] and open the Origin folder.
Open ‘plugin.py’ in any text editor.
Search for “return games” in this file.
Just above that line add the code provided : games.append(Game(“42069”, “The Witcher 3: Wild Hunt - Game of the Year Edition”, None, LicenseInfo(LicenseType.SinglePurchase, None)))
Make sure the spaces before this line and “return games” line are same because in python spaces are very important.
Save and relaunch GOG app → claim free game → check GOG account / email for confirmation
Remove the code line → relaunch Galaxy app and install the game.
And paste the code like this.
When you re-open GOG, it wil show Origin is syncing, then you just check “Owned Games”. There you wil find The Witcher 3. Open it and claim.
If anybody is still having problem try this trick
simply use notepad
count the spaces before the word “return” it could be 8 spaces check yours. Now go to games.append(game) line and press enter then 8 spaces and then the line mentioned in the post thats it, restart and claim.
For anyone who still has problems try replacing the double quotes in the code provided from your editor, otherwise it will give you a syntax error and you will not be able to claim the game. That worked for me, also check that there are 8 spaces before the line of code as @Falcon said