That function already exists. I've been using it on my page for several years: https://shop.spreadshirt.se/geektowns/