Metamorphosis does NOT change hero's abilities, even if the morphed form has another set of skills. You need to make a custom Engineering Upgrade skill, which you give to the unit after metamorphing in order to change its skills.
I can however offer a workaround, which wouldn't look too good, but may work quite well:
1) Give each hero 5 dummy skills, which do nothing, and are hidden. Base them on the yellow + ability, which usually gives bonus stats.
2) If you want your hero to be buying the skills - "When the hero buys skill from shop 1 - set a global variable (array) to the id of the skill he has bought.
I'd do it like: udg_skills[array], and players will have their skills saved like this - skill "i" (from 0 to 4) will be saved in udg_skills[ GetPlayerId(player)*5 + i ]
This way player 1's 1-st skill will be in udg_skills[0], 2-nd skill in udg_skills[1].... 5-th skill in udg_skills[4]; 2-nd player's 1-st skill will be in udg_skills[5], etc....
3) When "Player 1's hero" levels its 1-st "yellow plus" (dummy hero skill) - give the hero udg_skills[0]; When it's leveled again - set the skill's level to the level of the hero's 1-st yellow plus
call SetUnitAbilityLevel(hero, udg_skills[GetPlayerId(player)], GetUnitAbilityLevel(hero, udg_dummyskill[0]))
.
4) When you want to change the skill - remove the skill, and give the hero the new one:
JASS:
call UnitRemoveAbility(hero, udg_skills[p_id]) // removes the old skill
set udg_skills[p_id] = LoadInteger(udg_Table, 0, GetItemTypeId(GetManipulatedItem())) // I'd recomend linking the skills' IDs with the items' IDs via a hashtable.
// This way, when the player buys an item - you don't need to do 1000 'if' checks, you just need to load the value from the hashtable
// You will need to save all the values in the hashtable in an initializing trigger tho.
call UnitAddAbility(hero, udg_skills[p_id]) // So, with all the above said - you simply add the actual skill to the hero
call SetUnitAbilityLevel(hero, udg_skills[p_id], GetUnitAbilityLevel(hero, udg_dummyskill[0])) //And since you are replacing the skill - you'd likely want to keep its old level, so just give it (again) the level of the yellow plus skill
I know it may be a bit confusing when I'm showing you only parts of the triggers, but if you can script in jass - you should manage.
Also do note, that the dummy skills (the yellow pluses) are supposed to be hero abilities, and the actual skills should be
unit abilities.