We can create the following system of equations:
(1) Number of shirts the manager ordered was two more than twice the number of hats:
Let x be the number of shirts
Let y be the number of hats

(2) manager purchased a total of 38 souvenir:

Since we have our system of equations, to solve it we can isolate one variable from equation (2) and substitute it in equation (1):

(2) in (1):

He purchased 26 shirts.
Now, with the x-value we are going to substitute it in (2) to find the y-value(number of hats purchased)

He purchased 12 hats.
Answer:
He purchased 26 shirts and 12 hats.