Didn't Ezolile do it for you?
Anyway, whenever they buy, lets say a wooden pickaxe, you'll do a variable called %player%Pickaxe(Dynamic Variable) = Stone(Book Variable)
. Now whenever they open a chest you'll use Set Container Items(Game Action Code)
to set the items in the chest. If their variable is Stone, you'll set it to stone. If their variable is Golden, you'll set it to gold. Since I know you're making a 1v1 bedwars game, have the same copy of the chest for both teams. You'll use a different chest for each player. And yes, you have to set every single upgrade by hand as NBT editing doesn't exist here.