UPF 50+ on a hat describes a fabric, not a finished hat. It tells you how much ultraviolet radiation passes through the material under laboratory conditions. It does not tell you how much skin the hat covers, whether the claim is legal in your destination market, or whether the rating survives washing.
If a UPF 50+ claim is the reason you are buying, verify four things: the test report and the standard named on it, the coverage geometry of the hat, the labeling rule of the destination market, and the performance after washing or stretching. Missing any one of the four makes the claim unusable, and in several Southeast Asian markets an unsubstantiated UV claim leads to delisting or seizure.