The original sentence should use капелюх, as this is a more common word in Ukrainian for "hat". Шапка in Ukrainian means "a headline" or a "fur hat"
The first thing I imagine when I hear шапка is actually a beanie :)
But yes, what is commonly called "hat" is капелюх in Ukrainian
So why this course uses less common version? And I must say that I prefer "капелюх", because it's like Polish "kapelusz" and "шапка" is like Polish "czapka" - "cap", so it's confusing for me.
Cap is ‘кепка’ in Ukrainian. ‘Капелюх’ is a hat with brims. And ‘шапка’ is a common word for a hat when you don't know how to name it exactly, but in most cases it means something brimless.